Skip to content

Conversation

@Russzheng
Copy link

@Russzheng Russzheng commented Aug 25, 2018

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

def __init__(self, size=None, scale_factor=None):
    super(UpsamplingBilinear2d, self).__init__(size, scale_factor, mode='bilinear', align_corners=True)

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.

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, 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.


class Upsample(Module):
r"""Upsamples a given multi-channel 1D (temporal), 2D (spatial) or 3D (volumetric) data.

This comment was marked as off-topic.

[ 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.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

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.

Set default values of align_corners back to True
@weiyangfb
Copy link
Contributor

@ssnl would you like to comment on this when you have time?

Copy link
Contributor

@ailzhang ailzhang left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants