Back to Browse

PyTorch Explained: torch.Tensor vs torch.tensor!

222 views
Aug 24, 2025
25:51

#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

Download

1 formats

Video Formats

360pmp437.4 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

PyTorch Explained: torch.Tensor vs torch.tensor! | NatokHD