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

Fix interpolate Docs #7227

Merged
merged 2 commits into from
Jan 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions python/oneflow/nn/modules/interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,7 @@ def forward(self, x):
scale_factors = [self.scale_factor for _ in range(dim)]
else:
raise ValueError("either size or scale_factor should be defined")
if self.recompute_scale_factor is None:
if scale_factors is not None:
for scale in scale_factors:
if math.floor(scale) != scale:
warnings.warn(
"The default behavior for interpolate/upsample with float scale_factor changed in 1.6.0 to align with other frameworks/libraries, and now uses scale_factor directly, instead of relying on the computed output size. If you wish to restore the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details. "
)
break
elif self.recompute_scale_factor and self.size is not None:
if self.recompute_scale_factor and self.size is not None:
raise ValueError(
"recompute_scale_factor is not meaningful with an explicit size."
)
Expand Down Expand Up @@ -267,9 +259,6 @@ def interpolate(
When scale_factor is specified, if recompute_scale_factor=True,
scale_factor is used to compute the output_size which will then
be used to infer new scales for the interpolation.
The default behavior for recompute_scale_factor changed to False
in 1.6.0, and scale_factor is used in the interpolation
calculation.

For example:

Expand Down