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

Don't convert int array input to floatx #867

Closed mattdangerw closed 12 months ago

mattdangerw commented 12 months ago

In tf.keras, int array input is not converted to floatx. In keras-core, all array input is converted to flaotx.

This feels both like a regression compatibility wise, and quite surprising generally for subclass models. There are plenty of valid reasons to pass some int input to a model.

https://colab.research.google.com/gist/mattdangerw/2a030f1b14ec4fa3347711e84541e6d7/array-conversion-discrepency.ipynb

codecov[bot] commented 12 months ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (50c5f9a) 76.40% compared to head (0f1fcb8) 76.40%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #867 +/- ## ======================================= Coverage 76.40% 76.40% ======================================= Files 329 329 Lines 31327 31328 +1 Branches 6095 6096 +1 ======================================= + Hits 23934 23937 +3 + Misses 5809 5808 -1 + Partials 1584 1583 -1 ``` | [Flag](https://app.codecov.io/gh/keras-team/keras-core/pull/867/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/867/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | `76.31% <100.00%> (+<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. | [Files Changed](https://app.codecov.io/gh/keras-team/keras-core/pull/867?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team) | Coverage Δ | | |---|---|---| | [...\_core/trainers/data\_adapters/array\_data\_adapter.py](https://app.codecov.io/gh/keras-team/keras-core/pull/867?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team#diff-a2VyYXNfY29yZS90cmFpbmVycy9kYXRhX2FkYXB0ZXJzL2FycmF5X2RhdGFfYWRhcHRlci5weQ==) | `73.75% <100.00%> (+1.61%)` | :arrow_up: | | [...\_core/trainers/data\_adapters/data\_adapter\_utils.py](https://app.codecov.io/gh/keras-team/keras-core/pull/867?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=keras-team#diff-a2VyYXNfY29yZS90cmFpbmVycy9kYXRhX2FkYXB0ZXJzL2RhdGFfYWRhcHRlcl91dGlscy5weQ==) | `67.39% <100.00%> (ø)` | |

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

mattdangerw commented 12 months ago

Yeah, some missing cases for this class generally. Added.