Skip to content

Commit f448875

Browse files
committed
Use math.prod to multiply integers
1 parent 4b94241 commit f448875

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

array_api_compat/common/_linalg.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from typing import Literal, Optional, Tuple, Union
66
from ._typing import ndarray
77

8+
import math
9+
810
import numpy as np
911
if np.__version__[0] == "2":
1012
from numpy.lib.array_utils import normalize_axis_tuple
@@ -119,7 +121,7 @@ def vector_norm(x: ndarray, /, xp, *, axis: Optional[Union[int, Tuple[int, ...]]
119121
rest = tuple(i for i in range(x.ndim) if i not in normalized_axis)
120122
newshape = axis + rest
121123
_x = xp.transpose(x, newshape).reshape(
122-
(xp.prod([x.shape[i] for i in axis], dtype=int), *[x.shape[i] for i in rest]))
124+
(math.prod([x.shape[i] for i in axis]), *[x.shape[i] for i in rest]))
123125
_axis = 0
124126
else:
125127
_x = x

0 commit comments

Comments
 (0)