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 Resize for JIT single value sequences #7139

Merged
merged 2 commits into from
Jan 27, 2023
Merged

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Jan 26, 2023

prototype.transforms.Resize is broken for single value sequence inputs. They are required by JIT1 and should behave the same way as regular integer inputs

.. note::
In torchscript mode size as single int is not supported, use a sequence of length 1: ``[size, ]``.

However, _setup_size parses them to (size, size)

if isinstance(size, Sequence) and len(size) == 1:
return size[0], size[0]

which triggers a different path in the kernel.

This was not caught by our tests before, since we never bothered to test the "JIT variants" since the base assumption was that we won't keep support for it. Apart from #7135, this would be a BC break nevertheless since all users can rely on that syntax although it is only required for JIT.

cc @vfdev-5 @bjuncek

Footnotes

  1. I've just discovered this while working on JIT. That is unrelated to this PR.

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

Thanks Philip

@pmeier pmeier merged commit 455eda6 into pytorch:main Jan 27, 2023
@pmeier pmeier deleted the resize-jit branch January 27, 2023 09:41
facebook-github-bot pushed a commit that referenced this pull request Feb 8, 2023
Reviewed By: vmoens

Differential Revision: D43116126

fbshipit-source-id: 8816ddbdc61a64079c43e6fa3fc247cbccb4635e
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.

3 participants