Skip to content

test_reductions_2D flaky #8892

@jrbourbeau

Description

@jrbourbeau

dask\array\tests\test_reductions.p::test_reductions_2D recently failed due to a RuntimeWarning: invalid value encountered in reduce being elevated to an error (see this CI build over in #8881 (review)).

Full Traceback:
___________________________ test_reductions_2D[f4] ____________________________
[gw2] win32 -- Python 3.9.12 C:\Miniconda3\envs\test-environment\python.exe

dtype = 'f4'

    @pytest.mark.slow
    @pytest.mark.filterwarnings("ignore:overflow encountered in reduce:RuntimeWarning")
    @pytest.mark.parametrize("dtype", ["f4", "i4"])
    def test_reductions_2D(dtype):
        x = np.arange(1, 122).reshape((11, 11)).astype(dtype)
        a = da.from_array(x, chunks=(4, 4))
    
        b = a.sum(keepdims=True)
        assert b.__dask_keys__() == [[(b.name, 0, 0)]]
    
        reduction_2d_test(da.sum, a, np.sum, x)
>       reduction_2d_test(da.prod, a, np.prod, x)

dask\array\tests\test_reductions.py:197: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
dask\array\tests\test_reductions.py:143: in reduction_2d_test
    assert same_keys(da_func(darr, axis=()), da_func(darr, axis=()))
dask\array\reductions.py:398: in prod
    dt = getattr(np.empty((1,), dtype=a.dtype).prod(), "dtype", object)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

a = array([nan], dtype=float32), axis = None, dtype = None, out = None
keepdims = False, initial = <no value>, where = True

    def _prod(a, axis=None, dtype=None, out=None, keepdims=False,
              initial=_NoValue, where=True):
>       return umr_prod(a, axis, dtype, out, keepdims, initial, where)
E       RuntimeWarning: invalid value encountered in reduce

C:\Miniconda3\envs\test-environment\lib\site-packages\numpy\core\_methods.py:52: RuntimeWarning

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsUnit tests and/or continuous integration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions