diff --git a/dask/array/reductions.py b/dask/array/reductions.py index bc550681b83..6e8693aab1a 100644 --- a/dask/array/reductions.py +++ b/dask/array/reductions.py @@ -4,6 +4,7 @@ from functools import partial, wraps from itertools import product, repeat from math import factorial, log, ceil +import warnings import numpy as np from numbers import Integral, Number @@ -466,7 +467,8 @@ def moment_chunk(A, order=2, sum=chunk.sum, numel=numel, dtype='f8', meta=False, n = n.astype(np.int64) total = sum(A, dtype=dtype, **kwargs) - u = total / n + with warnings.catch_warnings(record=True): + u = total / n xs = [sum((A - u)**i, dtype=dtype, **kwargs) for i in range(2, order + 1)] M = np.stack(xs, axis=-1) return {'total': total, 'n': n, 'M': M} diff --git a/dask/array/tests/test_array_core.py b/dask/array/tests/test_array_core.py index 047718157ef..f597133174a 100644 --- a/dask/array/tests/test_array_core.py +++ b/dask/array/tests/test_array_core.py @@ -3880,3 +3880,12 @@ def test_auto_chunks_h5py(): with dask.config.set({'array.chunk-size': '1 MiB'}): x = da.from_array(d) assert x.chunks == ((256, 256, 256, 232), (512, 488)) + + +def test_no_warnings_from_blockwise(): + x = da.ones((15, 15), chunks=(5, 5)) + + with warnings.catch_warnings(record=True) as record: + (x.dot(x.T + 1) - x.mean(axis=0)).std() + + assert not record