The tensor.dtype is an attribute of a tensor object of the Tensor class in PyTorch (which is similar to a NumPy array). I.e., PyTorch tensors and NumPy arrays are relatively similar and totally different from say Python lists. In any case, the dtype, which is specific to PyTorch tensors and NumPy arrays give you much more specific information about the object. I.e., type() will just tell you that the tensor is an object created from class Tensor whereas dtype tells you also what data type the tensor has, i.e., float32, float64, int32, int64, and so forth
>>> tensor = torch.tensor([1, 2, 3])
>>> tensor.dtype
torch.int64
>>> type(tensor)
<class 'torch.Tensor'>


Then there is a case where you want to cast tensor object ‘abc’ by tacking a abc.numpy() constructor onto it. Yet, although imported, the numpy constructor is not anywhere a documented as a Tensor class method.

Not sure why it’s not documented. But in either case, this is just converting from PyTorch tensor to NumPy array. Again, these are mostly similar and usually you don’t need to do this, except you want to use some specific methods that are only available in NumPy but not in PyTorch. In 99% of the time in DL, you won’t to do that conversion.