Learn practical skills, build real-world projects, and advance your career
Created 4 years ago
Some Functions on Tensor Assignment 1 PyTorch Zero to GANs
An short introduction about PyTorch and about the chosen functions.
- Function 1 : torch.arange()
- Function 2 : torch.cat()
- Function 3 : torch.view()
- Function 4 : torch.diag()
- Function 5 : touch.cat()
# Import torch and other required modules
import torch
Function 1 -torch.arange()
Returns a 1-D tensor of size end-start/step with values from the interval [start, end) taken with common difference step beginning from start.
# Example 1
torch.arange(start=0,end=10,step=3)
tensor([0, 3, 6, 9])
We create a tensor using arange function where we give start to be 0 and end to be 10 wit step 3 . So the first value will be zero and later i+3,