#pytorch #deeplearning #ai
In this video, we discuss the difference between two ways of forming tensors in PyTorch: torch.Tensor and torch.tensor.
`torch.Tensor (class constructor)
- It's the actual tensor class in PyTorch.
- When called, it creates a new tensor object.
- By default, it creates tensors with `dtype=torch.float32`.
`torch.tensor` (factory function)
- It's a convenience function that creates tensors.
- It infers the data type from the input data automatically.
- It also always creates a new tensor (copies data).
- Generally more convenient for creating tensors from Python data.
Link: https://github.com/farhad-pourkamali/YouTubeTorch/blob/main/1_Basics.ipynb