Skip to content

Make count_nonzero to return array#154

Merged
niboshi merged 3 commits into
masterfrom
count_nonzero-array
Jun 20, 2017
Merged

Make count_nonzero to return array#154
niboshi merged 3 commits into
masterfrom
count_nonzero-array

Conversation

@unnonouno

Copy link
Copy Markdown
Contributor

I fixed count_nonzero to return ndarray instead of int. It is faster because there is not synchronization between CPU and GPU.
see also #95

@unnonouno unnonouno added the no-compat Disrupts backward compatibility label Jun 16, 2017

@niboshi niboshi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please check!

c = xp.count_nonzero(a)
self.assertIsInstance(c, int)
return c
return int(c)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Write some tests for c, just like in matrix_rank (#97).

c = xp.count_nonzero(a)
self.assertIsInstance(c, int)
return c
return int(c)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ditto (tests for c).

@niboshi niboshi self-assigned this Jun 17, 2017
@okuta okuta added this to the v2.0.0a milestone Jun 19, 2017
@niboshi niboshi added the cat:enhancement Improvements to existing features label Jun 19, 2017
@niboshi

niboshi commented Jun 20, 2017

Copy link
Copy Markdown
Member

LGTM!

@niboshi niboshi merged commit 6ac0c25 into master Jun 20, 2017
@niboshi niboshi deleted the count_nonzero-array branch June 20, 2017 09:33
kmaehashi pushed a commit to kmaehashi/cupy that referenced this pull request Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:enhancement Improvements to existing features no-compat Disrupts backward compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants