Solved by ptrblck in post #2 
              
              
                You are passing the input images as “channels-last” (NHWC), while PyTorch expects “channels-first” (NCHW). 
permute the input batch such that the channels are in dim1.