How to split a Pytorch tensor into different dimensions?
I’m new to Pytorch .
Let’s say I have a tensor that has this shape torch.size([1, 25200, 11])
I want to split it into 3 smaller tensors , each of 3 smaller tensors has the shape of 1st.
torch.size([1, 3, 80, 80, 11]) and 2nd torch.size([1, 3, 40, 40 , 11])
and 3rd torch.size([1, 3, 20, 20, 11)].
Really appreciate your help.
Thanks
Explain those numbers:
80x80x3 = 19200
40x40x3 = 4800
20x20x3=1200 , add these result we have 25200, 1 is batch size, 11 is classes + xywh

Something like this should work.
import torch
tensor = torch.ones((1, 25200, 11))
first_break = tensor[:, 0:19200, :].view((1, 3, 80, 80, 11))
second_break = tensor[:, 19200:19200+4800, :].view((1, 3, 40, 40, 11))
third_break = tensor[:, 19200+4800:19200+4800+1200, :].view((1, 3, 20, 20, 11))

If you give a bit more explanation and context the code could get cleaned up and not be so hardcoded, or maybe this gives you enough to run with.
