Pytorch: Increase indice of tensor to specific size
I have a tensor of [20, 3, 32, 32]
I want to increase the 3 to 64 ([20,64,32,32], where 20 is the batch size). I tried the repeat function. But that only gives me 63 or 66, because with repeat you can only tile (multiply) indices.
How can I solve this?
Thanks!

You can repeat using torch.repeat and then filter with indices.

t = torch.rand(20,3,32,32)
t.shape
torch.Size([20, 3, 32, 32])

t = t.repeat(1,22,1,1)[:,:-2,:,:]
t.shape
torch.Size([20, 64, 32, 32])

