File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ def vector_norm(
164
164
if axis is None :
165
165
# Note: xp.linalg.norm() doesn't handle 0-D arrays
166
166
_x = x .ravel ()
167
- axis = 0
167
+ _axis = 0
168
168
elif isinstance (axis , tuple ):
169
169
# Note: The axis argument supports any number of axes, whereas
170
170
# xp.linalg.norm() only supports a single axis for vector norm.
@@ -176,24 +176,25 @@ def vector_norm(
176
176
newshape = axis + rest
177
177
_x = xp .transpose (x , newshape ).reshape (
178
178
(math .prod ([x .shape [i ] for i in axis ]), * [x .shape [i ] for i in rest ]))
179
- axis = 0
179
+ _axis = 0
180
180
else :
181
181
_x = x
182
+ _axis = axis
182
183
183
- res = xp .linalg .norm (_x , axis = axis , ord = ord )
184
+ res = xp .linalg .norm (_x , axis = _axis , ord = ord )
184
185
185
186
if keepdims :
186
187
# We can't reuse xp.linalg.norm(keepdims) because of the reshape hacks
187
188
# above to avoid matrix norm logic.
188
189
shape = list (x .shape )
189
- axis = cast (
190
+ _axis = cast (
190
191
"tuple[int, ...]" ,
191
192
normalize_axis_tuple ( # pyright: ignore[reportCallIssue]
192
193
range (x .ndim ) if axis is None else axis ,
193
194
x .ndim ,
194
195
),
195
196
)
196
- for i in axis :
197
+ for i in _axis :
197
198
shape [i ] = 1
198
199
res = xp .reshape (res , tuple (shape ))
199
200
You can’t perform that action at this time.
0 commit comments