torchvision.datasets.ImageFolder is giving me a 3x3 grid of images intead of 1 image

I can't figure out why it's giving me 9 gray images in a 3x3 grid instead of just one color image (original image is not gray and has RGB channels). I have spent 5 hours on this. Thanks for the help.
Here is my code
test_path = &quot;asl_data/test/&quot; #path to the folder
test_data = torchvision.datasets.ImageFolder(test_path, transform=torchvision.transforms.ToTensor())
def test32():
    for x, y in test_data:
        print(x.shape)
        x = x.reshape(533,800,3)
        plt.axis(&quot;off&quot;)
        plt.imshow(x)
        plt.show()
        plt.axis(&quot;off&quot;)
        plt.imshow(x[:176,:267,:])
        break
test32()


Classic.
You reshape instead of permute.
See this thread on the crucial difference between the two.
Fix:
x = x.permute((1, 2, 0))
plt.imshow(x)

A simple visual example:
x, y = test_data[0]  # take one image
x.shape  # torch.Size([3, 223, 320])

# see the difference
fig, ax = plt.subplots(1,2)
ax[0].imshow(x.numpy().reshape(223, 320, 3))
ax[0].set_title('Wrong reshape instead of permute')

ax[1].imshow(x.permute((1,2,0)))
ax[1].set_title('correctly permuting')


