Hi Keras! About https://keras.io/api/layers/recurrent_layers/lstm/ option use_cudnn=False

This option doesn't work correctly on some situation.

On single use is OK. x = layers.LSTM(128, return_sequences=True,use_cudnn=False)(x)

But on complex is not. x = layers.Bidirectional(layers.LSTM(128, return_sequences=True,use_cudnn=False))(x)

The layers.Bidirectional() calls layers.LSTM 3 times at one operation. use_cudnn=False <-- first call is good. use_cudnn=Auto <-- second call is no good. use_cudnn=Auto <-- third call is no good.

Thus, how do i resolve this problem? I think. An one way is to change LSTM init param in direct.

class LSTM(RNN):
    ....
    def __init__(
        ....
        #use_cudnn="auto",
        use_cudnn=False,

The other way is,I want, to add a use_cudnn option to Model.compile option like jit_compile option.

    model.compile(
        ...
        jit_compile=False,
        use_cudnn=False,
    )

My PC Ubuntu 22.04 Python 3.10.12 virtual env keras 3.7.0 tensorflow 2.16.2 cuDNN v8.9.6

I am looking forward for your answer.

Comment From: mehtamansi29

Hi @tosa-no-onchan -

Thanks for reporting the issue. Can you help me with sample code to reproduce this issue ?

Comment From: tosa-no-onchan

Thank you for your reply.

Sure!

My program is https://github.com/tosa-no-onchan/opp_with_lstm

My use model is https://github.com/tosa-no-onchan/opp_with_lstm/blob/main/model.py

Original program is https://pylessons.com/speech-recognition

Comment From: sonali-kumari1

Hi @tosa-no-onchan - Could you please provide a sample code in the form of colab notebook to reproduce this issue? Thanks!

Comment From: tosa-no-onchan

Hi @sonali-kumari1 I am sorry, I had tried colab before, but I didn't know how to use it well.

Comment From: sonali-kumari1

@tosa-no-onchan, You can follow these steps:

  1. Log in to Google colab
  2. Create a new notebook via File > New Notebook
  3. Paste your code into the notebook cells.
  4. Click on File on the top-left side and select Save a copy as a GitHub Gist .
  5. Share the github gist link here.

Alternatively, you can share minimal reproducible code to replicate the reported behavior by clicking <> code option in the comment. Thanks!

Comment From: github-actions[bot]

This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.