Concatenate tensors as they are compued

I have a loop that has 4 iterations. In each iteration, I will compute a tensor of size [8, x, 128, 128], where x is a variable size.

I would like to concatenate each tensor to a another one (along dimension 1 here), as soon as it gets computed. However, I cannot use torch.stack() because (apparently), all the sizes need to be similar.

I cannot use, because I need to concatenate them as soon as they are computed.

EDIT: Never mind I figured it out!

Hi, may I ask how did you figure that out? thanks!