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

Comments

Projects
None yet
5 participants
@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

This comment has been minimized.

Show comment
Hide comment
@aselle

aselle Nov 2, 2016

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@lan2720

lan2720 Nov 2, 2016

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

lan2720 commented Nov 2, 2016

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

@tfka

This comment has been minimized.

Show comment
Hide comment
@tfka

tfka 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

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

This comment has been minimized.

Show comment
Hide comment
@lan2720

lan2720 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]

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

This comment has been minimized.

Show comment
Hide comment
@gdelab

gdelab 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...

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

This comment has been minimized.

Show comment
Hide comment
@ebrevdo

ebrevdo Jan 24, 2017

Contributor

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

Contributor

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