Loss script fixes#1645
Merged
wyli merged 7 commits intoProject-MONAI:masterfrom Feb 25, 2021
ericspod:loss_script_fixes
Merged
Conversation
…rchscript Signed-off-by: Eric Kerfoot <[email protected]>
Signed-off-by: Eric Kerfoot <[email protected]>
Signed-off-by: Eric Kerfoot <[email protected]>
Member
Author
|
/black |
Signed-off-by: monai-bot <[email protected]>
Signed-off-by: Eric Kerfoot <[email protected]>
Signed-off-by: Eric Kerfoot <[email protected]>
wyli
approved these changes
Feb 25, 2021
Contributor
wyli
left a comment
There was a problem hiding this comment.
thanks, these are non-breaking enhancements for torchscript support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1592.
Description
Fixes most of the loss functions to be compatible with Torchscript. Omits
LocalNormalizedCrossCorrelationLoss,GlobalMutualInformationLoss, andBendingEnergyLossas some significant code changes may be necessary. The changes made mostly are about dealing with Torchscript limitations regarding generator expressions or acceptable argument types.Unionfor example isn't compatible since statically-typed compiled code is targeted by Torchscript and this cannot handle this sort of polymorphism (I think).One outstanding issue is that
Enumclasses are not compatible with Torchscript in Pytorch<1.7. The tests for Dice, Tversky, and others is only run for versions 1.7 and up.Status
Ready
Types of changes
./runtests.sh --codeformat --coverage../runtests.sh --quick.make htmlcommand in thedocs/folder.