Learn practical skills, build real-world projects, and advance your career
# Uncomment and run the appropriate command for your operating system, if required

# Linux / Binder
# !pip install numpy torch==1.7.0+cpu torchvision==0.8.1+cpu torchaudio==0.7.0 -f https://download.pytorch.org/whl/torch_stable.html

# Windows
# !pip install numpy torch==1.7.0+cpu torchvision==0.8.1+cpu torchaudio==0.7.0 -f https://download.pytorch.org/whl/torch_stable.html

# MacOS
# !pip install numpy torch torchvision torchaudio
# Import torch and other required modules
import torch

Function 1 - torch.chunk(no_of_chunks,dimension)

Splits a tensor into a specific number of chunks.

Add some explanations

# Example 1 - working (change this)
t1 = torch.tensor([[1,2,3],[2,3,4]])
x = t1.chunk(2,0)
x
(tensor([[1, 2, 3]]), tensor([[2, 3, 4]]))

Explanation about example take a tensor and return two chunk along axis=0)