You would have to call transpose on the numpy array or .permute on the tensor to change the dimension order.
The view operation (test.view(1, 2, H, W)) will interleave the pixel values and thus create the wrong image.