Learn practical skills, build real-world projects, and advance your career
Created 4 years ago
Pytorch ZeroToGans
Pytorch basics - Assignment 1
An short introduction about PyTorch and about the chosen functions.
- Using torch to create tensors. torch.zeros() and torch.ones()
- Creating Tensors with random values using torch.randn()
- Squeeze and unsqueeze
- Transposing dimensions of the tensors using torch.transpose()
- Adding scalars and tensors using torch.add()
# Import torch and other required modules
import torch
Function 1 - torch.tensor (change this)
# Example 1 - working (Creates a tensor of given dimension, values filled by 1 only)
torch.ones([4,4])
tensor([[1., 1., 1., 1.],
[1., 1., 1., 1.],
[1., 1., 1., 1.],
[1., 1., 1., 1.]])
Explanation about example