mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 00:21:07 +01:00
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 |
||
|---|---|---|
| .. | ||
| backends | ||
| intrinsic | ||
| modules | ||
| parallel | ||
| qat | ||
| quantizable | ||
| quantized | ||
| utils | ||
| __init__.py | ||
| _reduction.py | ||
| common_types.py | ||
| cpp.py | ||
| functional.py | ||
| functional.pyi.in | ||
| grad.py | ||
| init.py | ||
| parameter.py | ||
| parameter.pyi | ||