Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with eval_mode(net): #1384

Merged
merged 5 commits into from
Dec 29, 2020
Merged

with eval_mode(net): #1384

merged 5 commits into from
Dec 29, 2020

Conversation

rijobro
Copy link
Contributor

@rijobro rijobro commented Dec 17, 2020

Description

Current:

net.eval()
with torch.no_grad():
    pass
net.train()

Proposed:

with eval_mode(net):
    pass

This is also useful when the train/eval state of a network could be one or the other, yet we want it to temporarily be in eval mode and return to original state at the end (e.g., gradcam).

To avoid conflicts, I haven't updated gradcam or occlusion sensitivity until #1381 is merged. I'll also update the tutorials.

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh --codeformat --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@wyli wyli merged commit a4b1144 into Project-MONAI:master Dec 29, 2020
@rijobro rijobro deleted the eval_mode branch January 4, 2021 12:12
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