PyTorch
Here we will discuss the torch.Tensor and some basic functions
Why PyTorch?
There are only a few major deep learning frameworks; and among them, PyTorch is emerging as a winner. PyTorch is an open-source machine learning library inspired by Torch.
Here are some reason to move towards PyTorch
- PyTorch is based on Python
- A dynamic approach to graph computation
- Fast and easy to train
- Increase productivity
- Simple to learn
Now we will discuss 5 basic functions of PyTorch
- torch.shape()
- torch.dim()
- torch.tril()
- torch.lerp()
- torch.clamp()
Now we will work with these functions one by one
Import torch and other required modules- torch.shape():
We will create a tensor array
shape of x in terms of dimensions2. torch.dim():
Get Praveen kumar’s stories in your inbox
Join Medium for free to get updates from this writer.
This function will tell us the shape is lie in which dimension i.e. of 1-Dimension, 2-Dimension or n-Dimension
3. torch.tril():
Note: The error occured because of the dimension of the array is under range.
therefor it requires the atleast 2-D array to execute the tril function4. torch.lerp():
5.torch.clamp():
This function will Clamp all elements in input into the range
[ min, max ] and return a resulting tensorConclusion: Therefore above are few functions of PyTorch and there are n-numbers of functions and we can do much more with them
Reference Link: Documentation for torch.Tensor: https://pytorch.org/docs/stable/tensors.html
AI work: https://www.aiworkbox.com/
Discussion forum of PyTorch: https://discuss.pytorch.org/
Youtube Lecture: https://youtu.be/vo_fUOk-IKk




