I am trying to create a grid of images (e.g. 3 by 3) from a batch of tensors that will be fed into a GAN through a data loader in the next step. With the below code I was able to transform the tensors into images that are displayed in a grid in the right position. The problem is, that they are all displayed in a separate grid as shown here: Figure 1 Figure 2 Figure 5. How can put them in one grid and just get one figure returned with all 9 images?? Maybe I am making it too complicated. :D In the end tensors out of the real_samples have to be transformed and put into a grid.
real_samples = next(iter(train_loader))
for i in range(9):
plt.figure(figsize=(9, 9))
plt.subplot(330 + i + 1)
plt.imshow(np.transpose(vutils.make_grid(real_samples[i].to(device)
[:40], padding=1, normalize=True).cpu(),(1,2,0)))
plt.show()



