Skip to content

Conversation

ankit-amazon
Copy link
Contributor

Addressed review comments

import torch
# Noncompliant: miss call to `eval()` after load.
model.load_state_dict(torch.load("model.pth"))
# Noncompliant: miss call to `eval()` after load.
Copy link

@linghuiluo linghuiluo May 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

miss call to eval() before evaluating the model.

model.load_state_dict(torch.load("model.pth"))
classes = ["T-shirt/top", "Trouser", "Pullover", "Dress", "Coat",
"Sandal", "Shirt", "Sneaker", "Bag", "Ankle boot"]
# Compliant: `eval()` is called after load.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eval() is called before evaluating the model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants