Different results for GAN model using save and load and directly using the model in current running session after training

I am training a conditional GAN model for generating images. condition is an image
The problem is following:
Say I train my model for 15 epochs, after that I save it using:

path_model = 'path.pt'

Now I generate images using this saved model on test dataset.
I load the model using:

load_model_name = 'path.pt'
model = Generator_c()   #genertor model of GAN

But the result obtained using this saved model (model) and the model I can access in my current session (Generator) after 15 epochs on the same inputs are very different.
1> Result from Saved and load model (model) on left and
2> Result from Generator in the current session (Generator) on right

I have compared the two by explicitly printing:


both giving the same output. Can anyone help me in understanding what might be the problem here ?


Since you’ve already compared the parameters of the loaded model, you should check the data loading pipeline next and make sure the data is processed in the same way.
As a quick check you could also use a static input (e.g. torch.ones) and compare the outputs of the model to make sure the actual model execution is not the problem.