Pytorch Torch Chunk
# PyTorch torch.chunk Function
* * PyTorch torch Reference](#)
`torch.chunk` is a PyTorch function used to split a tensor into chunks along a specified dimension.
### Function Definition
torch.chunk(tensor, chunks, dim)
* * *
## Example Usage
## Example
```python
import torch
x = torch.arange(12).reshape(3,4)
# Split into 3 chunks
result = torch.chunk(x, 3, dim=0)
print("Number of chunks:", len(result))
for i, t in enumerate(result):
print(f"Chunk {i}:", t.shape)
* * PyTorch torch Reference](#)
YouTip