Fix SSIMLoss when batchsize bigger than 2#5908
Merged
wyli merged 1 commit intoProject-MONAI:devfrom Jan 27, 2023
Merged
Conversation
Signed-off-by: Jakob Weigand <[email protected]>
Contributor
|
/build |
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.
Signed-off-by: Jakob Weigand [email protected]
Fixes #5886.
Description
When SSIMLoss is called with a tensor of batchsize > 1, SSIMMetric is called for each batch item individually. The result of each call to SSIMMetric is stored in ssim_val. Subsequently, ssim_val is concatenated to ssim_value, which is a collection of all calls to SSIMMetric. Before the concatenation both ssim_val and ssim_value are given a new view of size 1. As ssim_value collects the results of all earlier calls to SSIMMetric, .view(1) raises an error for the second call (as ssim_value has a different absolute size). This commit changes the behavior of the view call, to always use the current size of ssim_value, avoiding this issue but keeping the behavior to concatenate in a single row vector.
Types of changes
./runtests.sh -f -u --net --coverage../runtests.sh --quick --unittests --disttests.make htmlcommand in thedocs/folder.