Skip to content

Commit 8d0dded

Browse files
committed
Update numpy deprecated imports
1 parent b5c15dc commit 8d0dded

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pytensor/tensor/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def _get_vector_length_Constant(op: Op | Variable, var: Constant) -> int:
123123

124124
# isort: on
125125
# Allow accessing numpy constants from pytensor.tensor
126-
from numpy import e, euler_gamma, inf, infty, nan, newaxis, pi
126+
from numpy import e, euler_gamma, inf, nan, newaxis, pi
127127

128128
from pytensor.tensor.basic import *
129129
from pytensor.tensor.blas import batched_dot, batched_tensordot

pytensor/tensor/extra_ops.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from collections.abc import Collection, Iterable
22

33
import numpy as np
4-
from numpy.core.multiarray import normalize_axis_index
4+
from numpy.exceptions import AxisError
5+
from numpy.lib.array_utils import normalize_axis_index, normalize_axis_tuple
56

67
import pytensor
78
import pytensor.scalar.basic as ps
@@ -584,9 +585,9 @@ def squeeze(x, axis=None):
584585

585586
# scalar inputs are treated as 1D regarding axis in this `Op`
586587
try:
587-
axis = np.core.numeric.normalize_axis_tuple(axis, ndim=max(1, _x.ndim))
588-
except np.AxisError:
589-
raise np.AxisError(axis, ndim=_x.ndim)
588+
axis = normalize_axis_tuple(axis, ndim=max(1, _x.ndim))
589+
except AxisError:
590+
raise AxisError(axis, ndim=_x.ndim)
590591

591592
if not axis:
592593
# Nothing to do

0 commit comments

Comments
 (0)