Learn practical skills, build real-world projects, and advance your career
Created 4 years ago
A Guide to PyTorch
What is PyTorch??
Pytorch is a open-source machine-learning library in python.It is used in Natural Language Processing.
A tensor in pytorch is a collection on scalar,vector and matrix.
- zeros()
- storage()
- eye()
- stride()
- mm()
# Import torch and other required modules
import torch
1. zeros()
It returns a tensor filled with the scalar value 0.
points = torch.zeros(6)
points
tensor([0., 0., 0., 0., 0., 0.])
Here 1D array is created with 0. as by default.