Skip to content

Commit 4f6125c

Browse files
author
Vahid Tavanashad
committed
address comments
1 parent acbc442 commit 4f6125c

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

dpnp/linalg/dpnp_utils_linalg.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,10 +1188,9 @@ def _norm_int_axis(x, ord, axis, keepdims):
11881188
if x.shape[axis] == 0:
11891189
x = dpnp.moveaxis(x, axis, -1)
11901190
res_shape = x.shape[:-1]
1191-
result = dpnp.zeros_like(x, shape=res_shape)
11921191
if keepdims:
1193-
result = result.reshape(res_shape + (1,))
1194-
return result
1192+
res_shape += (1,)
1193+
return dpnp.zeros_like(x, shape=res_shape)
11951194
return dpnp.abs(x).max(axis=axis, keepdims=keepdims)
11961195
if ord == -dpnp.inf:
11971196
return dpnp.abs(x).min(axis=axis, keepdims=keepdims)
@@ -1226,16 +1225,14 @@ def _norm_tuple_axis(x, ord, row_axis, col_axis, keepdims):
12261225
12271226
"""
12281227

1229-
# pylint: disable=too-many-branches
12301228
axis = (row_axis, col_axis)
12311229
flag = x.shape[row_axis] == 0 or x.shape[col_axis] == 0
12321230
if flag and ord in [1, 2, dpnp.inf]:
12331231
x = dpnp.moveaxis(x, axis, (-2, -1))
12341232
res_shape = x.shape[:-2]
1235-
result = dpnp.zeros_like(x, shape=res_shape)
12361233
if keepdims:
1237-
result = result.reshape(res_shape + (1, 1))
1238-
return result
1234+
res_shape += (1, 1)
1235+
return dpnp.zeros_like(x, shape=res_shape)
12391236
if row_axis == col_axis:
12401237
raise ValueError("Duplicate axes given.")
12411238
if ord == 2:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ exclude-protected = ["_create_from_usm_ndarray"]
137137

138138
[tool.pylint.design]
139139
max-args = 11
140-
max-branches = 16
140+
max-branches = 17
141141
max-locals = 30
142142
max-positional-arguments = 9
143143
max-returns = 8

0 commit comments

Comments
 (0)