Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_nan_propagation works incorrectly for cumulative_sum #263

Open
ndgrigorian opened this issue May 16, 2024 · 1 comment
Open

test_nan_propagation works incorrectly for cumulative_sum #263

ndgrigorian opened this issue May 16, 2024 · 1 comment

Comments

@ndgrigorian
Copy link

Per spec,

if include_initial is False, the returned array must have the same shape as x.

however, test_nan_propagation expects the result to have an empty shape (i.e., be a scalar).

func_name = 'cumulative_sum', x = usm_ndarray([nan], dtype=float32), data = data(...)

    @reproduce_failure('6.102.4', b'AXicY2BkQAcAACUAAg==')
    @pytest.mark.parametrize(
        "func_name", [f.__name__ for f in category_to_funcs["statistical"]]
    )
    @given(
        x=hh.arrays(dtype=xps.floating_dtypes(), shape=hh.shapes(min_side=1)),
        data=st.data(),
    )
    def test_nan_propagation(func_name, x, data):
        func = getattr(xp, func_name)
        set_idx = data.draw(
            xps.indices(x.shape, max_dims=0, allow_ellipsis=False), label="set idx"
        )
        x[set_idx] = float("nan")
        note(f"{x=}")

        out = func(x)

>       ph.assert_shape(func_name, out_shape=out.shape, expected=())  # sanity check
E       AssertionError: out.shape=(1,), but should be () [cumulative_sum()]
@asmeurer
Copy link
Member

Fixed at #262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants