Learn practical skills, build real-world projects, and advance your career
Updated 4 years ago
Pytorch zero to gan: First Assignment
PyTorch is an open source machine learning library based on the Torch library, used for applications such as computer vision and natural language processing, primarily developed by Facebook's AI Research lab.
The functions chosen are as follows:-
- torch.zeros()
- torch.arange()
- torch.repeat()
- torch.eye()
- torch.where()
# Import torch and other required modules
import torch
Function 1 - torch.zeros()
This functions returns a tensor filled with 0(scalar value)
# Example 1 - working (change this)
torch.zeros(5,6)
tensor([[0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0., 0.]])
this function returns a matrix of 5 rows and 6 columns filled with zeros