I have trained several models and would like to compare their performance on a single image. The problem is that running the same model (let’s call it A) produces different results. I have set the model to evaluation mode (i.e. A = myModel.eval()) and I am using “with torch.no_grad()” yet every time I apply the model to my test image I get a different result. (I have several models but here I am demonstrating the problem with only one model!)

A = myModel.eval()

modelList = [A] # the list of models contains more models but I am just showing one here!

# looping over test images (here only one image)
for img in train_loader:
    with torch.no_grad():
        for models in modelList:
            models.to(device)
            img.to(device)
            modelResult = models(img)
            print(modelResult.mean())

This print line prints out different results every time I run the loop but I expect to get the same results every time since the model weights are the same and the image is the same image!
I’d appreciate your help,
Thank you