Skip to content

Commit

Permalink
Applied review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vfdev-5 committed Oct 15, 2021
1 parent 5d645e1 commit 27f53b3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions test/test_nn.py
Expand Up @@ -10533,6 +10533,8 @@ def test_upsamplingLinear1d(self):
input = torch.randn(1, 1, 2, requires_grad=True)
if not recompute_scale_factor:
gradcheck(lambda x: F.interpolate(x, out_size, **kwargs), (input,))
else:
gradcheck(lambda x: F.interpolate(x, scale_factor=scale_factor, **kwargs), (input,))

def test_upsamplingLinear1d_spatial_invariance(self):
m = nn.Upsample(scale_factor=3, mode='linear', align_corners=False)
Expand Down
2 changes: 1 addition & 1 deletion torch/nn/functional.py
Expand Up @@ -3627,7 +3627,7 @@ def interpolate(input: Tensor, size: Optional[int] = None, scale_factor: Optiona
output `size`. The computed output `size` will be used to infer new scales for
the interpolation. Note that when `scale_factor` is floating-point, it may differ
from the recomputed `scale_factor` due to rounding and precision issues.
If `recomputed_scale_factor` is ``False``, then `size` or `scale_factor` will
If `recompute_scale_factor` is ``False``, then `size` or `scale_factor` will
be used directly for interpolation.
.. note::
Expand Down
2 changes: 1 addition & 1 deletion torch/nn/functional.pyi.in
Expand Up @@ -305,7 +305,7 @@ def upsample(input: Any, size: Optional[Any] = ..., scale_factor: Optional[Any]


def interpolate(input: Any, size: Optional[Any] = ..., scale_factor: Optional[Any] = ..., mode: str = ...,
align_corners: Optional[Any] = ...): ...
align_corners: Optional[Any] = ..., recompute_scale_factor: Optional[Any] = ...): ...


def upsample_nearest(input: Any, size: Optional[Any] = ..., scale_factor: Optional[Any] = ...): ...
Expand Down
4 changes: 2 additions & 2 deletions torch/nn/modules/upsampling.py
Expand Up @@ -38,7 +38,7 @@ class Upsample(Module):
output `size`. The computed output `size` will be used to infer new scales for
the interpolation. Note that when `scale_factor` is floating-point, it may differ
from the recomputed `scale_factor` due to rounding and precision issues.
If `recomputed_scale_factor` is ``False``, then `size` or `scale_factor` will
If `recompute_scale_factor` is ``False``, then `size` or `scale_factor` will
be used directly for interpolation.
Shape:
Expand Down Expand Up @@ -126,7 +126,7 @@ class Upsample(Module):
[ 1.2000, 1.3600, 1.5200, 1.2800, 0.6400, 0.0000],
[ 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000]]]])
"""
__constants__ = ['size', 'scale_factor', 'mode', 'align_corners', 'name']
__constants__ = ['size', 'scale_factor', 'mode', 'align_corners', 'name', 'recompute_scale_factor']
name: str
size: Optional[_size_any_t]
scale_factor: Optional[_ratio_any_t]
Expand Down

0 comments on commit 27f53b3

Please sign in to comment.