returns 3D tensor rather than 4D tensor

Hello l have a list of tensors Y obtained by concatenating 10 tensors each of dimension (16,32,3) . Hence Y is of dimension [10,16,32,3].

Now l would like to concatenate Y using as follow :

        Y = []
        for O in np.arange(len(x)):
            x_p = self.conv_layer(x[O])

Then l apply to Y as follow :

x =

However :

torch.Size([160, 32, 3])

Rather than :
torch.Size([10,16, 32, 3])

What is wrong with my code ?

Thank you

Hi, concatenates along an existing dimension. and so the number of dimensions of the output is the same as the inputs.
torch.stack stacks a list of tensors along an new dimension. In that case the number of dimensions of the output is one more than the inputs.
I think you’re looking for the second in your case.