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

Add `ops.random.shuffle` #907

Closed james77777778 closed 10 months ago

james77777778 commented 10 months ago

I believe this op could be helpful when I came across the following PR: https://github.com/keras-team/keras-core/pull/884#discussion_r1326753668

codecov[bot] commented 10 months ago

Codecov Report

Patch coverage: 86.20% and project coverage change: -3.84% :warning:

Comparison is base (b4019bc) 83.63% compared to head (eeb31d6) 79.80%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #907 +/- ## ========================================== - Coverage 83.63% 79.80% -3.84% ========================================== Files 318 318 Lines 28391 28420 +29 Branches 5409 5413 +4 ========================================== - Hits 23745 22680 -1065 - Misses 3147 4281 +1134 + Partials 1499 1459 -40 ``` | [Flag](https://app.codecov.io/gh/keras-team/keras-core/pull/907/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/907/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `79.72% <86.20%> (-3.81%)` | :arrow_down: | | [keras_core-jax](https://app.codecov.io/gh/keras-team/keras-core/pull/907/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `?` | | | [keras_core-numpy](https://app.codecov.io/gh/keras-team/keras-core/pull/907/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `60.70% <34.48%> (-0.03%)` | :arrow_down: | | [keras_core-tensorflow](https://app.codecov.io/gh/keras-team/keras-core/pull/907/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `67.05% <41.37%> (-0.03%)` | :arrow_down: | | [keras_core-torch](https://app.codecov.io/gh/keras-team/keras-core/pull/907/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `69.41% <44.82%> (-0.03%)` | :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/907?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/jax/random.py](https://app.codecov.io/gh/keras-team/keras-core/pull/907?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team#diff-a2VyYXNfY29yZS9iYWNrZW5kL2pheC9yYW5kb20ucHk=) | `27.45% <33.33%> (-72.55%)` | :arrow_down: | | [keras\_core/backend/torch/random.py](https://app.codecov.io/gh/keras-team/keras-core/pull/907?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team#diff-a2VyYXNfY29yZS9iYWNrZW5kL3RvcmNoL3JhbmRvbS5weQ==) | `86.81% <80.00%> (-0.85%)` | :arrow_down: | | [keras\_core/backend/numpy/random.py](https://app.codecov.io/gh/keras-team/keras-core/pull/907?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team#diff-a2VyYXNfY29yZS9iYWNrZW5kL251bXB5L3JhbmRvbS5weQ==) | `100.00% <100.00%> (ø)` | | | [keras\_core/backend/tensorflow/random.py](https://app.codecov.io/gh/keras-team/keras-core/pull/907?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team#diff-a2VyYXNfY29yZS9iYWNrZW5kL3RlbnNvcmZsb3cvcmFuZG9tLnB5) | `100.00% <100.00%> (ø)` | | | [keras\_core/random/random.py](https://app.codecov.io/gh/keras-team/keras-core/pull/907?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team#diff-a2VyYXNfY29yZS9yYW5kb20vcmFuZG9tLnB5) | `86.66% <100.00%> (+1.48%)` | :arrow_up: | ... and [25 files with indirect coverage changes](https://app.codecov.io/gh/keras-team/keras-core/pull/907/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.

james77777778 commented 10 months ago

Please also add it in keras_core/random/random.py so we can export it to the public API and document it.

I didn't notice that there is a path for keras_core/random/random.py.

The function and corresponding docstring have been added.

EDITED: I believe the CI failure is unrelated to this PR, and I have no idea about it.