Learn practical skills, build real-world projects, and advance your career
Created 4 years ago
Title Here
Subtitle Here
An short introduction about PyTorch and about the chosen functions.
- function 1
- function 2
- function 3
- function 4
- function 5
# Import torch and other required modules
import torch
Function 1 - torch.cat
Concatenates the given sequence of seq tensors in the given dimension. All tensors must either have the same shape (except in the concatenating dimension) or be empty.
# Example 1
x = torch.randn(2, 3)
x
tensor([[ 0.6856, -1.0506, 0.4067],
[-0.0625, -1.4942, 0.4284]])
torch.cat((x, x, x), 0)
tensor([[ 0.6856, -1.0506, 0.4067],
[-0.0625, -1.4942, 0.4284],
[ 0.6856, -1.0506, 0.4067],
[-0.0625, -1.4942, 0.4284],
[ 0.6856, -1.0506, 0.4067],
[-0.0625, -1.4942, 0.4284]])