Skip to content

Remove deprecate warning for Upsampling#11568

Closed
ailzhang wants to merge 3 commits intopytorch:masterfrom
ailzhang:interpolate_module
Closed

Remove deprecate warning for Upsampling#11568
ailzhang wants to merge 3 commits intopytorch:masterfrom
ailzhang:interpolate_module

Conversation

@ailzhang
Copy link
Copy Markdown
Contributor

Fixes #11452 .

Based on the discussion with @ssnl and @soumith , we want to bring back Upsample as a module instead of introducing a new nn.interpolate module for now. If anyone want to do downsample, they should use nn.functional.interpolate instead.

Copy link
Copy Markdown
Collaborator

@ssnl ssnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was fast! Could you add a .. note:: to the doc and tell users if they want to resize/downsample, they should use torch.nn.functional.interpolate? (Btw, does interpolate support general resizing, i.e., to arbitrary size?)

@ailzhang
Copy link
Copy Markdown
Contributor Author

@ssnl Yep it does! Actually the tricky part is, if users use nn.Upsample for downsampling, that still works. Since it calls F.interpolate inside nn.Upsample :P So they don't have to use F.interpolate despite the misleading name.

size (tuple, optional): a tuple of ints `(H_out, W_out)` output sizes
scale_factor (int, optional): the multiplier for the image height or width

.. warning::

This comment was marked as off-topic.

This comment was marked as off-topic.

@ssnl
Copy link
Copy Markdown
Collaborator

ssnl commented Sep 12, 2018

@ailzhang Okay. But we can still link to F.interpolate :)

@vadimkantorov
Copy link
Copy Markdown
Contributor

vadimkantorov commented Sep 12, 2018

@ssnl A crazy idea: how about a generic nn.Wrap(F.interpolate, scale_factor = 2) - can make sense for stateless functions, will unblock people on absence of some modules, and even crazier nn.Sequential().add(F.interpolate, **kwargs) can exist.

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ailzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@ailzhang
Copy link
Copy Markdown
Contributor Author

@pytorchbot retest this please

Comment thread torch/nn/modules/upsampling.py Outdated
.. warning::
This class is deprecated in favor of :func:`~nn.functional.interpolate`.
.. note::
If you want down sampling, you should use :func:`~nn.functional.interpolate`.

This comment was marked as off-topic.

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ailzhang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@ailzhang
Copy link
Copy Markdown
Contributor Author

@pytorchbot retest this please

@nehz
Copy link
Copy Markdown
Contributor

nehz commented Mar 11, 2019

Any updates on this ?

@gchanan
Copy link
Copy Markdown
Contributor

gchanan commented Mar 11, 2019

@nehz this has already been committed.

@nehz
Copy link
Copy Markdown
Contributor

nehz commented Mar 12, 2019

I'm still seeing it on the master and 1.0.1 branch ?
https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/upsampling.py
warnings.warn("nn.{} is deprecated. Use nn.functional.interpolate instead.".format(self.name))

@ssnl ssnl mentioned this pull request Mar 12, 2019
@ssnl
Copy link
Copy Markdown
Collaborator

ssnl commented Mar 12, 2019

blaming #14123 cc @eellison

@gchanan
Copy link
Copy Markdown
Contributor

gchanan commented Mar 12, 2019

@ailzhang ?

@ailzhang
Copy link
Copy Markdown
Contributor Author

Yea this got added back accidentally in another PR. I'm sending a quick patch to fix. Thanks @ssnl @gchanan !

facebook-github-bot pushed a commit that referenced this pull request Mar 12, 2019
Summary:
IIRC we decided to remove warning in code in #11568. This got reverted accidentally in #14123.
Pull Request resolved: #17921

Differential Revision: D14422811

Pulled By: ailzhang

fbshipit-source-id: 7067264bd1d3e3b7861d29e18ade2969ed705ca1
@ezyang ezyang added the merged label Jun 26, 2019
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Fixes pytorch#11452 .

Based on the discussion with SsnL  and soumith , we want to bring back Upsample as a module instead of introducing a new nn.interpolate module for now. If anyone want to do downsample, they should use `nn.functional.interpolate ` instead.
Pull Request resolved: pytorch#11568

Differential Revision: D9804359

Pulled By: ailzhang

fbshipit-source-id: 2b232d55fc83c2b581bf336f1ee8d1cf1c1159ca
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
IIRC we decided to remove warning in code in pytorch#11568. This got reverted accidentally in pytorch#14123.
Pull Request resolved: pytorch#17921

Differential Revision: D14422811

Pulled By: ailzhang

fbshipit-source-id: 7067264bd1d3e3b7861d29e18ade2969ed705ca1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upsampling modules deprecated

7 participants