PyTorch is a package, and the tutorial recommend:
But I would say, in the old NumPy and TensorFlow way
import torch as tc
- The default data type is float32, when repr() invoked from one tensor of this type, the dtype will not be displayed
- The default int/float type means int32/float32
- Basic functions are provided, like
- They accept both
- using tc.tensor() will always copy the data from the source
The PyTorch framework support from-and-to integration of NumPy.
NOTE that Tensor seems to be inherited from NumPy arrays. Therefore, if there is certain calculation, we could expect something like: the calculation happens to either of the two will be operating from those.
### Transfer different target to corresponding devices
Tensor.to(self, device_name: str)
The torch.autograd module provide automatic gradients computation for every use cases.