Solved by ptrblck in post #3 
              
              
                I believe this line of code: 
at::Tensor tensor_image = torch::from_blob(img.data, { 3, img.rows, img.cols}, at::kByte);

would interleave the tensor, since OpenCV would load the image in a channels-last memory layout, while you are loading it to a channels-first tensor_image, so you might need to l…