Skip to content

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