pytorch
468a73f0 - Support Numpy ints in the `torch.nn.functional.interpolate` dtype check (#110778)

Commit
1 year ago
Support Numpy ints in the `torch.nn.functional.interpolate` dtype check (#110778) In https://github.com/pytorch/pytorch/pull/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): https://github.com/pytorch/pytorch/pull/99243#issuecomment-1646736646. 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 ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/110778 Approved by: https://github.com/mikaylagawarecki
Author
Committer
Parents
Loading