mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Migrates usages of deprecated APIs in NumPy-2.0 per [numpy-2.0 migration guide](https://numpy.org/devdocs/numpy_2_0_migration_guide.html#numpy-2-0-migration-guide). I did a grep on the old API usages (see list below) and these were used only referenced in test files under `test/torch_np/numpy_tests/**/*.py`. Specifically, migrates the usages of the following APIs: 1. `np.sctypes` → Access dtypes explicitly instead 2. `np.float_` → `np.float64` 3. `np.complex_` → `np.complex128` 4. `np.longcomplex` → `np.clongdouble` 5. `np.unicode_` → `np.str_` 6. `np.product` → `np.prod` 7. `np.cumproduct` → `np.cumprod` 8. `np.alltrue` → `np.all` 9. `np.sometrue` → `np.any` Pull Request resolved: https://github.com/pytorch/pytorch/pull/131909 Approved by: https://github.com/rgommers, https://github.com/Skylion007, https://github.com/atalman
35 lines
556 B
Python
35 lines
556 B
Python
# mypy: ignore-errors
|
|
|
|
from . import fft, linalg, random
|
|
from ._dtypes import * # noqa: F403
|
|
from ._funcs import * # noqa: F403
|
|
from ._getlimits import finfo, iinfo
|
|
from ._ndarray import (
|
|
array,
|
|
asarray,
|
|
ascontiguousarray,
|
|
can_cast,
|
|
from_dlpack,
|
|
ndarray,
|
|
newaxis,
|
|
result_type,
|
|
)
|
|
from ._ufuncs import * # noqa: F403
|
|
from ._util import AxisError, UFuncTypeError
|
|
|
|
|
|
from math import pi, e # usort: skip
|
|
|
|
|
|
all = all
|
|
alltrue = all
|
|
|
|
any = any
|
|
sometrue = any
|
|
|
|
inf = float("inf")
|
|
nan = float("nan")
|
|
|
|
False_ = False
|
|
True_ = True
|