how to save the generated images for every batch and epoch from CNN model this is the code from my machine learning model