Skip to content

Conversation

ezhang887
Copy link
Contributor

@ezhang887 ezhang887 commented Oct 7, 2023

In #99243, a check was added to ensure the size only contained integers.

This PR updates the check to also include numpy integers based on this comment (cc @kit1980): #99243 (comment). Similar to the other commenter, I also ran into issues where existing software broke due to this after upgrading to PT2.1:

                if not torch.jit.is_scripting():
                    if not all(_is_integer(x) for x in size):
>                       raise TypeError(
                            "expected size to be one of int or Tuple[int] or Tuple[int, int] or "
                            f"Tuple[int, int, int], but got size with types {[type(x) for x in size]}"
                        )
E                       TypeError: expected size to be one of int or Tuple[int] or Tuple[int, int] or Tuple[int, int, int], but got size with types [<class 'numpy.int64'>, <class 'numpy.int64'>]

/conda-env/lib/python3.8/site-packages/torch/nn/functional.py:3924: TypeError

@pytorch-bot
Copy link

pytorch-bot bot commented Oct 7, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/110778

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 09e9f13 with merge base 563728f (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@ezhang887 ezhang887 marked this pull request as ready for review October 7, 2023 01:26
@ezhang887 ezhang887 changed the title Support Numpy arrays in the torch.nn.functional.interpolate dtype check Support Numpy ints in the torch.nn.functional.interpolate dtype check Oct 7, 2023
Copy link
Contributor

@mikaylagawarecki mikaylagawarecki left a comment

Choose a reason for hiding this comment

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

Looks ok since the linked comment mentioned that interpolate used to work with size as a tuples of numpy integers on 2.0.1

@mikaylagawarecki mikaylagawarecki added release notes: nn release notes category topic: not user facing topic category labels Oct 9, 2023
Co-authored-by: mikaylagawarecki <mikaylagawarecki@gmail.com>
@ezhang887
Copy link
Contributor Author

@pytorchbot merge -g

@pytorch-bot
Copy link

pytorch-bot bot commented Oct 9, 2023

❌ 🤖 pytorchbot command failed:

@pytorchbot: error: unrecognized arguments: -g

usage: @pytorchbot [-h] {merge,revert,rebase,label,drci} ...

Try @pytorchbot --help for more info.

@ezhang887
Copy link
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 9, 2023
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

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

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged open source release notes: nn release notes category topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants