Conv3d error on dimensions of a 5d tensor
I have a tensor shaped ([5, 1, 3, 126, 126]), which represents a video (5 frames each 126x126 rgb).
I need to forward it into a
self.resnet = nn.Sequential(
        nn.Conv3d(5,5,1), 
        nn.UpsamplingBilinear2d(size=None, scale_factor=0.5)  
    )

but i get
RuntimeError: Given groups=1, weight of size [5, 5, 1, 1, 1], expected input[5, 1, 3, 126, 126] to have 5 channels, but got 1 channels instead

I think that I have probably misunderstood how the conv3d works but I can't really understand why the expected dimensions are so different from the ones that my 5d tensor has at that moment

The reason this is happening is because the shape of your tensor is wrong. The Conv3d class expects the batch_size to come first then the number of channels then the number of frames then the height and width. That is why you are getting the error. You should change the shape of your input tensor to [5,3,1,126,126] Your conv3d parameters are also wrong. The first number should be the number of input channels the conv3d is supposed to get which in your case is 3 because it is an rgb image. The second number is the number of output channels which you do not need to change.
