torch.Tensor.size Tensor.size(dim=None) → torch.Size or int Returns the size of the self tensor. If dim is not specified, the returned value is a , a subclass of . If is specified, returns an int holding the size of that dimension.