keras-team / keras

Deep Learning for humans
http://keras.io/
Apache License 2.0
62.13k stars 19.49k forks source link

Add hard_shrink activation function #20470

Closed shashaka closed 2 weeks ago

shashaka commented 2 weeks ago

Since Keras lacks built-in support for the hard_shrink activation function, I implemented it across TensorFlow, JAX, and NumPy, aiming to maintain consistency with existing implementations available in PyTorch.

codecov-commenter commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 88.57143% with 4 lines in your changes missing coverage. Please review.

Project coverage is 82.09%. Comparing base (8409e18) to head (2650507). Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
keras/api/_tf_keras/keras/activations/__init__.py 0.00% 1 Missing :warning:
keras/api/_tf_keras/keras/ops/__init__.py 0.00% 1 Missing :warning:
keras/api/_tf_keras/keras/ops/nn/__init__.py 0.00% 1 Missing :warning:
keras/src/ops/nn.py 92.30% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #20470 +/- ## ========================================== + Coverage 82.07% 82.09% +0.01% ========================================== Files 515 515 Lines 47416 47474 +58 Branches 7439 7446 +7 ========================================== + Hits 38919 38972 +53 - Misses 6691 6694 +3 - Partials 1806 1808 +2 ``` | [Flag](https://app.codecov.io/gh/keras-team/keras/pull/20470/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | Coverage Δ | | |---|---|---| | [keras](https://app.codecov.io/gh/keras-team/keras/pull/20470/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `81.94% <88.57%> (+0.01%)` | :arrow_up: | | [keras-jax](https://app.codecov.io/gh/keras-team/keras/pull/20470/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `65.02% <68.57%> (+0.01%)` | :arrow_up: | | [keras-numpy](https://app.codecov.io/gh/keras-team/keras/pull/20470/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `59.99% <74.28%> (+0.03%)` | :arrow_up: | | [keras-tensorflow](https://app.codecov.io/gh/keras-team/keras/pull/20470/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `66.04% <65.71%> (+0.01%)` | :arrow_up: | | [keras-torch](https://app.codecov.io/gh/keras-team/keras/pull/20470/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `64.94% <68.57%> (+0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.