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

libnd4j: where_np shape function needs proper implementation #6226

Closed
AlexDBlack opened this issue Aug 21, 2018 · 4 comments
Closed

libnd4j: where_np shape function needs proper implementation #6226

AlexDBlack opened this issue Aug 21, 2018 · 4 comments
Labels
Bug Bugs and problems High Priority

Comments

@AlexDBlack
Copy link
Contributor

https://github.com/deeplearning4j/deeplearning4j/blob/master/libnd4j/include/ops/declarable/generic/boolean/where_np.cpp#L121-L145

Currently hard-coded to [10,10] output.
I believe it should have shape [numMatches, rank(input)], where numMatches is the number of non-zero elements.

@AlexDBlack AlexDBlack added Bug Bugs and problems C++ labels Aug 21, 2018
@shugeo shugeo self-assigned this Aug 21, 2018
@shugeo
Copy link
Contributor

shugeo commented Aug 21, 2018

Numpy behave the next way:

  • if only one param used (condition matrix), then "If only condition is given, return the tuple condition.nonzero(), the indices where condition is True."
  • if two params uses - error occurs (ValueError: either both or neither of x and y should be given).

@shugeo
Copy link
Contributor

shugeo commented Aug 21, 2018

The TF behave as follow:

A Tensor with the same type and shape as x, y if they are non-None. A Tensor with shape (num_true, dim_size(condition)).

the Where op behave as TF.

@AlexDBlack
Copy link
Contributor Author

Right, that was my conclusion. The op implementation seems correct, but the shape function is wrong.

@lock
Copy link

lock bot commented Sep 22, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Sep 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Bugs and problems High Priority
Projects
None yet
Development

No branches or pull requests

2 participants