Mark jnp.{NINF,NZERO,PZERO} as deprecated.

This follows the upstream NumPy deprecation of these names (https://github.com/numpy/numpy/pull/24357).

PiperOrigin-RevId: 555548986
This commit is contained in:
Peter Hawkins 2023-08-10 10:24:40 -07:00 committed by jax authors
parent cf026ce745
commit 0e80d959c8
3 changed files with 20 additions and 6 deletions

View File

@ -26,6 +26,13 @@ Remember to align the itemized text with the first line of an item within a list
* `jax.jaxpr_util` has been removed from the public JAX namespace.
* `JAX_USE_PJRT_C_API_ON_TPU` no longer has an effect (i.e. it always defaults to true).
* Deprecations:
* Several `jax.numpy` APIs have been deprecated following
[NumPy NEP-52](https://numpy.org/neps/nep-0052-python-api-cleanup.html):
* `jax.numpy.NINF` has been deprecated. Use `-jax.numpy.inf` instead.
* `jax.numpy.PZERO` has been deprecated. Use `0.0` instead.
* `jax.numpy.NZERO` has been deprecated. Use `-0.0` instead.
* Internal deprecations:
* The internal utilities `jax.core.is_opaque_dtype` and `jax.core.has_opaque_dtype`
have been removed. Opaque dtypes have been renamed to Extended dtypes; use

View File

@ -100,9 +100,6 @@ pi = np.pi
e = np.e
euler_gamma = np.euler_gamma
inf = np.inf
NINF = -np.inf # TODO: removed in Numpy 1.26
PZERO = 0.0 # TODO: removed in Numpy 1.26
NZERO = -0.0 # TODO: removed in Numpy 1.26
nan = np.nan
# NumPy utility functions

View File

@ -22,9 +22,6 @@ from jax._src.basearray import Array as ndarray
from jax._src.numpy.lax_numpy import (
ComplexWarning as ComplexWarning,
NINF as NINF, # TODO: removed in Numpy 1.26
NZERO as NZERO, # TODO: removed in Numpy 1.26
PZERO as PZERO, # TODO: removed in Numpy 1.26
allclose as allclose,
angle as angle,
append as append,
@ -444,6 +441,19 @@ _deprecations = {
"jax.numpy.sometrue is deprecated. Use jax.numpy.any",
any,
),
# Added August 10, 2023:
"NINF": (
"jax.numpy.NINF is deprecated. Use -jax.numpy.inf instead.",
-inf,
),
"NZERO": (
"jax.numpy.NZERO is deprecated. Use -0.0 instead.",
-0.0,
),
"PZERO": (
"jax.numpy.PZERO is deprecated. Use 0.0 instead.",
0.0,
),
}
import typing