Conversation
Resolve each input bound independently in Normalize.make_params so an explicitly supplied in_min or in_max is honored even when the other bound is left to be computed from the data percentiles. Previously the explicit value was silently discarded unless both bounds were given. Add regression tests for the in_min-only and in_max-only cases. Fixes TorchIO-project#1509
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.
Summary
Normalizeignores an explicitly suppliedin_minwhenin_maxisNone, and vice versa — the explicit value is silently discarded and both bounds are computed from the data percentiles instead. This happens becausemake_paramsonly uses the explicit bounds when both are provided.This PR resolves each input bound independently: an explicitly supplied bound is always honored, and only the missing one is computed from the percentiles. Behaviour when both bounds are given, or when both are
None, is unchanged.Reproduction (before this PR)
Changes
Normalize.make_params: resolvein_min/in_maxindependently and override the auto-computed bound(s) with any explicit value.in_min-only andin_max-only cases.Fixes #1509