summaryrefslogtreecommitdiff
path: root/numpy/_array_api
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-01-11 17:26:04 -0700
committerAaron Meurer <asmeurer@gmail.com>2021-01-11 17:26:04 -0700
commitc8efdbb72eab78ed2fc735d3078ef8534dcc6ef7 (patch)
tree9050b589231862b34b0c3faf043c1de068e0fed2 /numpy/_array_api
parentf36b64848a4577188640cc146840d5652deb6bc0 (diff)
downloadnumpy-c8efdbb72eab78ed2fc735d3078ef8534dcc6ef7.tar.gz
Fix different behavior of norm() with axis=None in the array API namespace
Diffstat (limited to 'numpy/_array_api')
-rw-r--r--numpy/_array_api/linear_algebra_functions.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/numpy/_array_api/linear_algebra_functions.py b/numpy/_array_api/linear_algebra_functions.py
index 9995e6b98..820dfffba 100644
--- a/numpy/_array_api/linear_algebra_functions.py
+++ b/numpy/_array_api/linear_algebra_functions.py
@@ -55,6 +55,9 @@ def inv(x):
def norm(x, /, *, axis=None, keepdims=False, ord=None):
# Note: this function is being imported from a nondefault namespace
from ..linalg import norm
+ # Note: this is different from the default behavior
+ if axis == None and x.ndim > 2:
+ x = x.flatten()
return norm(x, axis=axis, keepdims=keepdims, ord=ord)
def outer(x1, x2, /):