pytorch/torch/nn
Eric Zhang 468a73f0e3 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
2023-10-10 01:46:33 +00:00
..
backends DOC: Various typo fixes (#97095) 2023-03-20 20:46:04 +00:00
intrinsic ao migration: fix broken import, try 2 (#94458) 2023-02-09 22:20:01 +00:00
modules torch::nn::AdaptiveLogSoftmaxWithLoss: check length of cutoffs (#106777) 2023-10-05 05:35:47 +00:00
parallel Log usage of optimizer in backward (#110206) 2023-09-29 11:00:07 +00:00
qat
quantizable
quantized [ao] fixing public v private for torch.ao.nn.X (#87883) 2022-12-15 03:03:07 +00:00
utils [test][docs] Fix doctest warnings for syntax errors (#110517) 2023-10-05 00:00:06 +00:00
__init__.py Back out "Reland "Make adding buffers more like adding parameters (#104069)" (#106224)" (#106743) 2023-08-08 15:27:34 +00:00
_reduction.py [BE] Enable ruff's UP rules and autoformat nn/ mps/ and torch/ (#105436) 2023-07-21 07:38:46 +00:00
common_types.py
cpp.py Add non-recursive module.to_empty option (#104197) 2023-06-26 21:47:22 +00:00
functional.py Support Numpy ints in the torch.nn.functional.interpolate dtype check (#110778) 2023-10-10 01:46:33 +00:00
functional.pyi.in Better function annotations for nn.functional (#102918) 2023-06-16 19:48:04 +00:00
grad.py Enable xdoctest runner in CI for real this time (#83816) 2022-12-29 05:32:42 +00:00
init.py [BE]: Update ruff to 0.285 (#107519) 2023-08-22 23:16:38 +00:00
parameter.py [BE]: Update ruff to 0.285 (#107519) 2023-08-22 23:16:38 +00:00
parameter.pyi Back out "Reland "Make adding buffers more like adding parameters (#104069)" (#106224)" (#106743) 2023-08-08 15:27:34 +00:00