Skip to content

Commit 49f9ba7

Browse files
committed
revert
1 parent ad375dc commit 49f9ba7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

array_api_compat/common/_linalg.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def vector_norm(
164164
if axis is None:
165165
# Note: xp.linalg.norm() doesn't handle 0-D arrays
166166
_x = x.ravel()
167-
axis = 0
167+
_axis = 0
168168
elif isinstance(axis, tuple):
169169
# Note: The axis argument supports any number of axes, whereas
170170
# xp.linalg.norm() only supports a single axis for vector norm.
@@ -176,24 +176,25 @@ def vector_norm(
176176
newshape = axis + rest
177177
_x = xp.transpose(x, newshape).reshape(
178178
(math.prod([x.shape[i] for i in axis]), *[x.shape[i] for i in rest]))
179-
axis = 0
179+
_axis = 0
180180
else:
181181
_x = x
182+
_axis = axis
182183

183-
res = xp.linalg.norm(_x, axis=axis, ord=ord)
184+
res = xp.linalg.norm(_x, axis=_axis, ord=ord)
184185

185186
if keepdims:
186187
# We can't reuse xp.linalg.norm(keepdims) because of the reshape hacks
187188
# above to avoid matrix norm logic.
188189
shape = list(x.shape)
189-
axis = cast(
190+
_axis = cast(
190191
"tuple[int, ...]",
191192
normalize_axis_tuple( # pyright: ignore[reportCallIssue]
192193
range(x.ndim) if axis is None else axis,
193194
x.ndim,
194195
),
195196
)
196-
for i in axis:
197+
for i in _axis:
197198
shape[i] = 1
198199
res = xp.reshape(res, tuple(shape))
199200

0 commit comments

Comments
 (0)