Learn practical skills, build real-world projects, and advance your career
Updated 4 years ago
Assignment 1
Pytorch functions
The next functions are in different categories such as reduction operations and others.
- Variance
- Equality
- Meshgrid
- Determinant
- Integral estimation
# Import torch and other required modules
import torch
Variance - torch.var()
Computes the variance of all elements in the tensor.
# Example 1
a = torch.rand(3,2)
a
tensor([[0.6225, 0.0801],
[0.9252, 0.2917],
[0.5757, 0.7284]])
A random tensor (a) of dimension 2 is generated with the rand() function.