Why EfficientNet same model return different predictions

Hello, when I run the following code I found although the mode and input are same,the predictions are different.

!pip install efficientnet_pytorch -q


import torch 
import torch.nn as nn
import efficientnet_pytorch as efn

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
device

model = efn.EfficientNet.from_name('efficientnet-b0')
model = model.to(device)

img = torch.ones((2, 3, 680, 680))*0.5
img = img.to(device)
preds1 = model(img)
preds2 = model(img)
preds3 = model(img)

print(preds1[0][0])
print(preds2[0][0])
print(preds3[0][0])

del model, img, preds1, preds2, preds3

These are outputs.

tensor(0.2599, grad_fn=<SelectBackward>)
tensor(0.1364, grad_fn=<SelectBackward>)
tensor(0.1263, grad_fn=<SelectBackward>)

Do you know why this happens? Thank you for clarificaton.

Wow, solved! I checked the Efficientnet-pytorch source code and suddendly found I should turn the model to eval() mode.

Now the predictions are same!!

model = efn.EfficientNet.from_name('efficientnet-b0')
model = model.to(device)
_ = model.eval()  ## hey, look here!!

img = torch.ones((2, 3, 680, 680))*0.5
img = img.to(device)
preds1 = model(img)
preds2 = model(img)
preds3 = model(img)

print(preds1[0][0])
print(preds2[0][0])
print(preds3[0][0])