Oh it’s actually very funny.
#torch.Size([3, 2, 618, 1100])
In this composition you have a BatchxImagesxrowsxcolums
so when you reshape it takes pixels from dimensions at the right and places them until filling new shape dimensions
so this means it goes to
m[0,0,0,0] takes that pixel and goes to m_reshape[0,0,0]
so it is filling the row 0 of m_reshape with colum pixels from m. Those pixels are dog image in fact.
The problem is that in m, in dimension 3 you have 1100 elements, meanwhile in dimension 2 of m_reshape you have 2200 elements, so it actually takes 2 rows from m to fill a row of m_reshape.
That’s why you can see that streching efect on the image. You are basically taking dogs[0::2] to create the image on the top left and then dogs[1::2] to create image in the top right.
Obviously when dog image is finished, this is, when you have already used m[0,0,:,:] it takes moves to m[0,1,:,:] to keep taking pixels. That dimension corresponds to cat and basically has same effect. The interesting point is that as you are using 2 rows of m to fill a colum of m_reshape, you are later on filling those “missing” colums with cat info creating this strange composition.
I hope you could understand my messy explanation