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

Add custom gradient #19279

Merged
merged 2 commits into from
Mar 11, 2024
Merged

Conversation

james77777778
Copy link
Contributor

Related to #18442

This op doesn't support numpy and torch backends.

I have tried to add support for torch backends but failed.
The reason is that the function signature and ctx mechanism is quite different from torch compared to tf/jax.
Ref: https://pytorch.org/tutorials/beginner/examples_autograd/two_layer_net_custom_function.html

@codecov-commenter
Copy link

codecov-commenter commented Mar 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.66%. Comparing base (c8700f4) to head (ce14ad5).
Report is 86 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19279      +/-   ##
==========================================
- Coverage   80.14%   75.66%   -4.48%     
==========================================
  Files         341      365      +24     
  Lines       36163    39778    +3615     
  Branches     7116     7712     +596     
==========================================
+ Hits        28982    30099    +1117     
- Misses       5578     8013    +2435     
- Partials     1603     1666      +63     
Flag Coverage Δ
keras 75.51% <100.00%> (-4.48%) ⬇️
keras-jax 59.70% <77.77%> (-3.36%) ⬇️
keras-numpy 54.24% <66.66%> (-2.84%) ⬇️
keras-tensorflow 61.21% <77.77%> (-3.44%) ⬇️
keras-torch 60.32% <55.55%> (-3.55%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@fchollet fchollet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I would not have expected this to be feasible for torch indeed.

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Mar 11, 2024
@fchollet fchollet merged commit b97338e into keras-team:master Mar 11, 2024
7 checks passed
@google-ml-butler google-ml-butler bot removed ready to pull Ready to be merged into the codebase kokoro:force-run labels Mar 11, 2024
@james77777778 james77777778 deleted the add-custom-gradient branch March 13, 2024 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Assigned Reviewer
Development

Successfully merging this pull request may close these issues.

4 participants