How can I expand tensor size?

i have
input = torch.randn(48, 64, 8, 28, 28)
and i want to resize it to (48,128,8,28,50) with zeros at once

I know this is not working but just for example,
t = torch.cat([input, torch.zeros(48,64,8,28,22)],dim=(1,4))

import torch
input = torch.randn(48, 64, 8, 28, 28)
t = input.new_zeros(48,128,8,28,50)
t[:,:64,:,:,:28] = input
1 Like