Saving GAN Output

Hi everyone. Total n00b question. I am just getting started at learning how to use PyTorch to generate images and train neural networks. I have been using this tutorial https://pytorch.org/tutorials/beginner/dcgan_faces_tutorial.html
as a way to learn about PyTorch. I would like to save all of the images generated during the last epoch, but as individual files, not in a grid. I am really having a hard time figuring this out. Would anyone have any advice/tips/tricks to accomplish this? Thank you in advance.

You can loop though img_list and save every image using plt.savefig. Something along the below code.

for i in range(len(img_list)):
    plt.savefig(str(i)+'.png', img_list[0])

Thanks for the tip. Will this save every image the model generates or will this just save the image for the last epoch?

To select the last epoch, you need to get the index of the epoch loop and then test if the index is indeed the last epoch.

for epoch in range(epochs):
    if epoch == epochs - 1:
        # save your images here