RuntimeError: Expected 3D (unbatched) or 4D (batched) input to conv2d, but got input of size: [1, 1, 374, 402, 3]

I am getting error in this line. I can’t understand why I am getting this.

Had to add in the comment section as new users can’t upload more than one media.

nn.Conv2d expects an input in the shape [batch_size, channels, height, width] while you are passing a 5-dimensional input as given in the error message.
Remove the unnecessary dimension and permute the input to have the aforementioned channels-first memory layout.

PS: you can post code snippets by wrapping them into three backticks ```.