Hello all, I have been trying to use this method but fail each time. basically I have two images that I stored in a list (using img_lst.append((img1,img2)). one image is the input image and the other is its reconstruction.
They are both gray scale images.
This is how I tried to do :
def visualize(imgs_list, rows=2, cols=10):
    fig = plt.figure(figsize=(10,5))
    print(f'number of samples: {len(imgs_list)}')
    for i in range(len(imgs_list)):
        img,recons = imgs_list[i]
        img = img.cpu().permute(1,2,0)
        recons = recons.cpu().detach().permute(1,2,0)
        f = [img,recons]
        ax = fig.add_subplot(rows, cols, i+1, xticks=[], yticks=[])
        ax.imshow(torchvision.utils.make_grid(f), cmap='Greys_r')

but this fails with the error :

RuntimeError: The expanded size of the tensor (3) must match the existing size (28) at non-singleton dimension 0.  Target sizes: [3, 28, 1].  Tensor sizes: [28, 28, 1]

if I remove permute, it complains about the dimensions being invalid :

TypeError : Invalid dimensions for image data

I’m completely lost here! how is this supposed to work?
Can anyone kindly please help me understand this?
Thanks a lot in advance