-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Upsampling fix v0.4.1 #10879
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
Upsampling fix v0.4.1 #10879
Conversation
Fix issue pytorch#7264. Modified torch/nn/modules/upsampling.py. In the documentation, it says default value of align_corners is False. However, it is hard coded to True, which causes issue when using ONNX module: pytorch#6900. I added align_corners parameter to the init function and changed the default value to False.
Fix issue pytorch#7264 and pytorch#6900. In the documentation, it says default value of align_corners is False. However, it is hard coded to True, which causes issue when using ONNX module: pytorch#6900. I added align_corners parameter to the init function and changed the default value to False.
Fix issue pytorch#7264. Modified torch/nn/modules/upsampling.py. In the documentation, it says default value of align_corners is False. However, it is hard coded to True, which causes issue when using ONNX module: pytorch#6900. I added align_corners parameter to the init function and changed the default value to False. 242255a
wrong path
Wrong path, used the most recent version.
|
|
||
| class Upsample(Module): | ||
| r"""Upsamples a given multi-channel 1D (temporal), 2D (spatial) or 3D (volumetric) data. | ||
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
|
||
| class Upsample(Module): | ||
| r"""Upsamples a given multi-channel 1D (temporal), 2D (spatial) or 3D (volumetric) data. | ||
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
| [ 3.0000, 3.3333, 3.6667, 4.0000]]]]) | ||
| """ | ||
| def __init__(self, size=None, scale_factor=None): | ||
| super(UpsamplingBilinear2d, self).__init__(size, scale_factor, mode='bilinear', align_corners=True) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
No new lines changes.
| [ 3.0000, 3.3333, 3.6667, 4.0000]]]]) | ||
| """ | ||
| def __init__(self, size=None, scale_factor=None): | ||
| super(UpsamplingBilinear2d, self).__init__(size, scale_factor, mode='bilinear', align_corners=True) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Set default values of align_corners back to True
|
@ssnl would you like to comment on this when you have time? |
ailzhang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @ssnl and @zou3519 that we shouldn't change behavior of deprecated classes. G
iven that we have correct behavior in torch.nn.functional.interpolate and even Upsample, maybe it's good to keep it as it is and move users to the new APIs. We do have a warning in torch.nn.functional.interpolate saying the default behavior has changed. See https://github.com/pytorch/pytorch/blob/master/torch/nn/functional.py#L2104
Thanks a lot for the PR @Russzheng ! I'll close it for now, feel free to reopen if you have any questions.
Fix issues #6900 and #7264, I think it is still not fully resolved right now. As in https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/upsampling.py
You cannot pass the align_corners parameters to UpsamplingBilinear2d(). Should add a parameter here to fix it. It would raise problem when using UpsamplingBilinear2d() or ONNX.