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 indexing with a boolean nnabla.Variable or NdArray #581

Merged
merged 1 commit into from
Feb 1, 2020

Conversation

TE-StephenTiedemann
Copy link
Contributor

Indexing with a boolean array must produce the index at positions where the index contains True values. This worked with lists and numpy arrays but went wrong for nnabla.NdArray or nnabla.Variable of boolean values:

>>> x = nnabla.Variable.from_numpy_array(numpy.array([11, 22, 33]))
>>> i = nnabla.Variable.from_numpy_array(numpy.array([True, False, True]))
>>> x[i.d].d == x[[True, False, True]].d
array([ True,  True])
>>> x[i.d].d == x[i].d
False

This PR extends the implementation such that x[i].d == x[i.d].d is all true.

@KazukiYoshiyama-sony KazukiYoshiyama-sony added the release-note-op-layer Auto-release; Layer Functions label Feb 1, 2020
@KazukiYoshiyama-sony KazukiYoshiyama-sony merged commit 92ee7fb into master Feb 1, 2020
@KazukiYoshiyama-sony KazukiYoshiyama-sony added release-note-bugfix Auto-release; Bugfix and removed release-note-op-layer Auto-release; Layer Functions labels Feb 1, 2020
@TE-StephenTiedemann TE-StephenTiedemann deleted the fix/20200130_boolean_index_variable branch February 3, 2020 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-bugfix Auto-release; Bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants