Skip to content

Commit b3ff024

Browse files
BUG: fix AttributeError in dpnp.linalg.norm (#939)
fix `AttributeError: 'bool' object has no attribute 'astype'` in `dpnp.linalg.norm` Co-authored-by: Alexander-Makaryev <[email protected]>
1 parent 1ad29a1 commit b3ff024

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dpnp/linalg/dpnp_algo_linalg.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ cpdef object dpnp_norm(object input, ord=None, axis=None):
237237
elif ord == -numpy.inf:
238238
return dpnp.array([dpnp.abs(input).min(axis=axis)])
239239
elif ord == 0:
240-
return dpnp.array([dpnp.sum(dpnp.astype((input != 0), input.dtype), axis=axis)])
240+
return input.dtype.type(dpnp.count_nonzero(input, axis=axis))
241241
elif ord is None or ord == 2:
242242
s = input * input
243243
return dpnp.sqrt(dpnp.sum(s, axis=axis))

0 commit comments

Comments
 (0)