summaryrefslogtreecommitdiff
path: root/numpy/array_api/_statistical_functions.py
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-12-07 15:35:20 -0700
committerAaron Meurer <asmeurer@gmail.com>2021-12-07 15:35:20 -0700
commit19a398ae78c3f35ce3d29d87b35da059558d72b4 (patch)
tree03210ad81b2c2b1dbad4ef6f4990846208264674 /numpy/array_api/_statistical_functions.py
parent7ca1d1ad0dc86f0d20414c946eb2b6e8dc19c367 (diff)
downloadnumpy-19a398ae78c3f35ce3d29d87b35da059558d72b4.tar.gz
BUG: Fix handling of the dtype parameter to numpy.array_api.prod()
Diffstat (limited to 'numpy/array_api/_statistical_functions.py')
-rw-r--r--numpy/array_api/_statistical_functions.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/array_api/_statistical_functions.py b/numpy/array_api/_statistical_functions.py
index 7bee3f4db..5bc831ac2 100644
--- a/numpy/array_api/_statistical_functions.py
+++ b/numpy/array_api/_statistical_functions.py
@@ -65,8 +65,8 @@ def prod(
# Note: sum() and prod() always upcast float32 to float64 for dtype=None
# We need to do so here before computing the product to avoid overflow
if dtype is None and x.dtype == float32:
- x = asarray(x, dtype=float64)
- return Array._new(np.prod(x._array, axis=axis, keepdims=keepdims))
+ dtype = float64
+ return Array._new(np.prod(x._array, dtype=dtype, axis=axis, keepdims=keepdims))
def std(