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

Fix sparse min/max to return sparse matrix #3536

Merged
merged 7 commits into from
Jul 21, 2020

Conversation

takagi
Copy link
Member

@takagi takagi commented Jul 3, 2020

Close #3504.

This PR fixes sparse min/max to return a value as a sparse matrix. I will parameterize the test in another PR.


return value
mask = value != 0
major_index = cupy.compress(mask, major_index)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK to leave the following issues because the PR is a bugfix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll revisit these points in another PR!

assert numpy.array_equal(da_cupy_values, da_scipy_values)
da_cupy_values = cp_matrix.min(axis=0)
da_scipy_values = dm_data.min(axis=0)
testing.assert_array_equal(da_scipy_values.A, da_scipy_values.A)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testing.assert_array_equal does not support sparse, while testing.numpy_cupy_array_equal and testing.numpy_cupy_allclose do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I make the tests use testing.numpy_cupy_arrray_equal. Would you check them? To test nonzero parameter, which SciPy does not have yet scipy/scipy#11899 and will be marked as experimental in #3583, I supply a bit messy SciPy inputs.

@toslunar toslunar added the cat:bug Bugs label Jul 15, 2020
@toslunar
Copy link
Member

Jenkins, test this please.

@pfn-ci-bot
Copy link
Collaborator

Successfully created a job for commit 5431fc6:

Copy link
Member

@toslunar toslunar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and I resolved the conflicts with #3515. Could you check if my commits are correct, @takagi?

@chainer-ci
Copy link
Member

Jenkins CI test (for commit 5431fc6, target branch master) failed with status FAILURE.

@takagi
Copy link
Member Author

takagi commented Jul 21, 2020

Thanks! I'll fix the SciPy input to make it work in case axis=None and nonzero=True.

@toslunar
Copy link
Member

Jenkins, test this please.

@pfn-ci-bot
Copy link
Collaborator

Successfully created a job for commit 570ddcc:

@chainer-ci
Copy link
Member

Jenkins CI test (for commit 570ddcc, target branch master) succeeded!

@toslunar toslunar merged commit 54fe55a into cupy:master Jul 21, 2020
@takagi takagi deleted the sparse-min-max-compat branch July 21, 2020 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sparse min/max have less SciPy-compatibility
5 participants