Pytorch part 2
Feb 24, 2022
--
cont.
Similar to numpy where exist multi-dimensional array, the pytorch tensorflow are build up of tensors.
TENSORS
ever heard of it. Let’s begin.
- They are same as numpy arrays except that they have flexibility to run in GPU.
Types of
- FloatTensor: 32-bit float
- DoubleTensor: 64-bit float
- HalfTensor: 16-bit float
- IntTensor: 32-bit int
- LongTensor: 64-bit int
some basic functions
- torch.add()
- torch.sub()
- torch.mm() <matrix multiplication>
- torch.div()
- torch.t()
- torch.cat()
- a.reshape()
# converting the numpy array to tensor
- tensor = torch.from_numpy(a)
In next section lets discuss more about the common pytorch Modules… part 3 .