Learn practical skills, build real-world projects, and advance your career
Updated 4 years ago
Assignment-1
PyTorch 5 Basic Functions
PyTorch: Zero to GANS
Overview of PyTorch functions with examples.
- torch.square()
- torch.reshape()
- torch.tensor.item()
- torch.cat()
- torch.ceil()
# Import torch and other required modules
import torch
Function 1 - torch.square()
Returns square of the elemet.
# Example 1 - A element square is returned.
a = torch.randn(4)
torch.square(a)
a
tensor([ 0.5160, -1.1102, -0.8410, 1.1848])
Square of the tensor is returned by the tensor.