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

C API Locking prevents custom gradient definition #48767

Closed
rnett opened this issue Apr 27, 2021 · 5 comments · Fixed by #48944
Closed

C API Locking prevents custom gradient definition #48767

rnett opened this issue Apr 27, 2021 · 5 comments · Fixed by #48944
Labels
comp:core issues related to core part of tensorflow stat:contribution welcome Status - Contributions welcome type:bug Bug

Comments

@rnett
Copy link
Contributor

rnett commented Apr 27, 2021

I am trying to add custom gradient support to the Java bindings (tensorflow/java#292). This is currently being prevented by the fact that TF_AddGradientsWithPrefix requires a lock on the graph, but so do any operation creation methods (i.e. TF_NewOperation), so it is impossible to create ops in gradient functions.

Is there a way I can get around this? I am considering calling TF_NewOperationLocked directly but I assume the locks are there for a reason.

@rnett rnett added the type:others issues not falling in bug, perfromance, support, build and install or feature label Apr 27, 2021
@amahendrakar amahendrakar added comp:apis Highlevel API related issues type:support Support issues and removed type:others issues not falling in bug, perfromance, support, build and install or feature labels Apr 28, 2021
@jvishnuvardhan jvishnuvardhan added comp:core issues related to core part of tensorflow type:bug Bug stat:awaiting tensorflower Status - Awaiting response from tensorflower and removed comp:apis Highlevel API related issues type:support Support issues labels Apr 28, 2021
@kkimdev kkimdev added stat:contribution welcome Status - Contributions welcome and removed stat:awaiting tensorflower Status - Awaiting response from tensorflower labels May 6, 2021
@kkimdev
Copy link
Contributor

kkimdev commented May 6, 2021

Thanks for reporting the issue!

@saxenasaurabh
Copy link
Member

Please feel free to send a PR!

@rnett
Copy link
Contributor Author

rnett commented May 6, 2021

I can, but what's the preferred solution? Providing and exposing a TF_AddGradientsWithPrefixLocked that doesn't lock, or exposing TF_NewOperationLocked and TF_FinishOperationLocked? (See #48815)

@saxenasaurabh
Copy link
Member

Exposing TF_NewOperationLocked and TF_FinishOperationLocked sgtm.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:core issues related to core part of tensorflow stat:contribution welcome Status - Contributions welcome type:bug Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants