Closed james77777778 closed 10 months ago
Patch coverage: 69.91%
and project coverage change: +11.40%
:tada:
Comparison is base (
6383d8a
) 72.28% compared to head (94daabd
) 83.69%. Report is 1 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Also, we should start testing consistency between symbolic outputs and real op outputs. That's a of checks over all, so it would justify the introduce of a new TestCase for dtypes.
We should add dtype checks in unit tests for all operations affected here, to check that we're in fact getting the same dtype across backends, including for
array
. I think there might be ops where some backends will return float64 instead of float32. This will help us avoid inconsistencies.Also, we should start testing consistency between symbolic outputs and real op outputs. That's a of checks over all, so it would justify the introduce of a new TestCase for dtypes.
I can add some new test cases in keras_core/ops/numpy_test.py
:
class NumpySymbolicDtypeTest(testing.TestCase):
...
class NumpyTensorDtypeTest(testing.TestCase):
...
Is it good?
However, It may take some time to implement the result_dtype
-like function for all backends.
class NumpyTensorDtypeTest(testing.TestCase):
Yes, that sounds good!
However, It may take some time to implement the result_dtype-like function for all backends.
We may be able to use a test parameterization to save time/code. We can parameterize the input dtype, for instance. But in some cases we may also be able to parameterize the op functions, for groups of ops that have similar arguments.
Hi @fchollet
I want to verify whether this PR is on the right track.
I am attempting to implement a Keras Core version of result_dtype
in keras_core/backend/common/dtypes.py
.
Currently, the result matchs jnp.result_dtype
when the input is python scalar types
(as demonstrated in keras_core/backend/common/dtypes_test.py
)
If it is good, I will refactor some of ops.numpy.*
and add the previously mentioned tests.
Keras Core is becoming Keras 3, and we're switching development to the main repository! Please reopen this PR in the keras-team/keras repository. Unfortunately we aren't able to automatically transfer PRs (but we have transferred all issues).
This PR unifies the default dtype behavior in
ops.numpy.*
and ensures that they respectbackend.floatx()
A subtle bug has been caught in
dropout_rnn_cell_test.py
: We should perform a custom mixed precision check because we can't initializecell
withdtype="mixed_float16"
inself.run_layer_test
.EDITED:
WIP:
backend.dtypes
functionalityops.numpy