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

Gradient for gather_nd is not implemented #5342

Closed
lan2720 opened this issue Nov 2, 2016 · 6 comments
Closed

Gradient for gather_nd is not implemented #5342

lan2720 opened this issue Nov 2, 2016 · 6 comments
Assignees
Labels

Comments

@lan2720
Copy link

@lan2720 lan2720 commented Nov 2, 2016

Hi all,

when I use tf.gather_nd, It gives me the error "NotImplementedError: Gradient for gather_nd is not implemented".

I can temporarily solve this problem to flatten both of params and indices and then use tf.gather. But it isn't the best way to do so.

Is there any plan to support that? Thanks!

@aselle
Copy link
Member

@aselle aselle commented Nov 2, 2016

Yes, we are planning to support that. The patch will be imminently committed. @narphorium is implementing it.

@aselle aselle added the type:feature label Nov 2, 2016
@lan2720
Copy link
Author

@lan2720 lan2720 commented Nov 2, 2016

@aselle Oh great. Thanks for your quick reply. I'm looking forward to it.

@tfka
Copy link

@tfka tfka commented Nov 2, 2016

@lan2720 。。how to flatten, I meet the same problem and I am a newer to tensorflow . Hope some advice for me . Thanks

@lan2720
Copy link
Author

@lan2720 lan2720 commented Nov 2, 2016

@tfka Yes, to use tf.gather you just need to reshape your params and indices.

For example

params = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]]
indices = [[2, 3, 1], [4, 0, 2], [3, 4, 0]]
# After some operation
new_params = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
new_indices = [2, 3, 1, 4+5, 0+5, 2+5, 3+10, 4+10, 0+10]
@gdelab
Copy link

@gdelab gdelab commented Jan 24, 2017

Hi,
Is it fixed yet ? I'm using gather_nd() and I don't get any warning, but my gradient descent does not seem to work properly, so I guess it could come from there...

@ebrevdo
Copy link
Contributor

@ebrevdo ebrevdo commented Jan 24, 2017

gather_nd gradients are available on master, and should be in the latest minor release:

https://github.com/tensorflow/tensorflow/blob/cb17d1b0e2b581b5da1d9597b7929ba764749d38/tensorflow/python/ops/array_grad.py

@ebrevdo ebrevdo closed this Jan 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.