Results 342 comments of François Chollet

> This branch has conflicts that must be resolved Please resolve merge conflicts.

> is there a workaround to make keras + Pytorch fully trasparent to pure pytorch code Keras is written in pure Python. When you are calling a Keras model with...

You can put the test in `keras/src/layers/rnn/rnn_test.py` alongside `test_statefulness_two_states`. You can target `layer = layers.RNN(TwoStatesRNNCell(2), stateful=True)` as the RNN layer.

Can you take a look at the test failures? I think they are likely related to the fact that torch tests are running with `data_format="channels_first"`. https://github.com/keras-team/keras/actions/runs/11469236802/job/31916066253?pr=20368

This is expected behavior -- if you create any element of state, then you should also override `update_state` and `reset_state`. We could make the default behavior of `reset_state` more general...

+1 to @rchao: we're open to contributions for such a feature. No plans on our side.

For JAX, we may want to rely on Pallas. For TF, since we can't rely on custom ops, we may have to skip support. Presumably we should add it in...

Fixed here: https://github.com/keras-team/keras/commit/b3e0b46323618cc1cf56715a9b9cf4baf2918a4b

I tried running your snippet 20x and added a call to `gc.collect()` inside the loop. Here's what I get: ``` Memory usage after 0 run(s) (in MiB): 950.141 Memory usage...