keras-team / keras-core

A multi-backend implementation of the Keras API, with support for TensorFlow, JAX, and PyTorch.
Apache License 2.0
1.27k stars 115 forks source link

Fix `stop_gradient` in np #872

Closed james77777778 closed 11 months ago

james77777778 commented 11 months ago

We should return x instead of None in numpy's stop_gradient.

A unit test has been added to verify the return value.

codecov[bot] commented 11 months ago

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.02% :warning:

Comparison is base (ac8a204) 76.45% compared to head (393d906) 76.43%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #872 +/- ## ========================================== - Coverage 76.45% 76.43% -0.02% ========================================== Files 329 329 Lines 31333 31333 Branches 6100 6100 ========================================== - Hits 23955 23950 -5 - Misses 5799 5802 +3 - Partials 1579 1581 +2 ``` | [Flag](https://app.codecov.io/gh/keras-team/keras-core/pull/872/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | Coverage Δ | | |---|---|---| | [keras_core](https://app.codecov.io/gh/keras-team/keras-core/pull/872/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `76.34% <100.00%> (-0.02%)` | :arrow_down: | 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. | [Files Changed](https://app.codecov.io/gh/keras-team/keras-core/pull/872?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | Coverage Δ | | |---|---|---| | [keras\_core/backend/numpy/core.py](https://app.codecov.io/gh/keras-team/keras-core/pull/872?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team#diff-a2VyYXNfY29yZS9iYWNrZW5kL251bXB5L2NvcmUucHk=) | `94.81% <100.00%> (+0.74%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/keras-team/keras-core/pull/872/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team)

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