Solved by ptrblck in post #3 
              
              
                The error is raised by an nn.Conv2d layer, which expects an input with 3 channels, while it seems you are trying to pass an input tensor with 5 channels (in a wrong memory layout) to this layer. 
Assuming my assumption is correct and your input contains 5 channels, you would have to first permute it…