keras-team / keras

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

Add tanh_shrink activation #20480

Closed shashaka closed 2 weeks ago

shashaka commented 2 weeks ago

Since Keras lacks built-in support for the tanh_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 87.87879% with 4 lines in your changes missing coverage. Please review.

Project coverage is 82.09%. Comparing base (04ced2d) to head (947db49).

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 91.66% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #20480 +/- ## ======================================= Coverage 82.09% 82.09% ======================================= Files 515 515 Lines 47476 47509 +33 Branches 7446 7447 +1 ======================================= + Hits 38975 39004 +29 - Misses 6694 6698 +4 Partials 1807 1807 ``` | [Flag](https://app.codecov.io/gh/keras-team/keras/pull/20480/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/20480/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `81.95% <87.87%> (+<0.01%)` | :arrow_up: | | [keras-jax](https://app.codecov.io/gh/keras-team/keras/pull/20480/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `65.03% <69.69%> (+<0.01%)` | :arrow_up: | | [keras-numpy](https://app.codecov.io/gh/keras-team/keras/pull/20480/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `60.01% <72.72%> (+<0.01%)` | :arrow_up: | | [keras-tensorflow](https://app.codecov.io/gh/keras-team/keras/pull/20480/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `66.04% <66.66%> (+<0.01%)` | :arrow_up: | | [keras-torch](https://app.codecov.io/gh/keras-team/keras/pull/20480/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `64.95% <69.69%> (+<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.

fchollet commented 2 weeks ago

By the way, can I interest you in adding bounding box transformation support to more of the image preprocessing layers?

shashaka commented 2 weeks ago

I'll work on implementing the bounding box transformation further. However, I've noticed there are additional steps involved in preprocessing, like affine transformation and smart resizing. Understanding the logic behind these steps might take me some time.