Failed to fit with the RNN layers

Recently I bought a new Macbook Air M1 2020 and followed the instructions to install the tensorflow-macos and tensorflow-metal.

Then I tried to work out the tensorflow NLP example

https://www.tensorflow.org/text/tutorials/text_classification_rnn

to create a model

model = tf.keras.Sequential([
    encoder,
    tf.keras.layers.Embedding(
        input_dim=len(encoder.get_vocabulary()),
        output_dim=64,
        # Use masking to handle the variable sequence lengths
        mask_zero=True),
    tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(64)),
    tf.keras.layers.Dense(64, activation='relu'),
    tf.keras.layers.Dense(1)
])

but it failed to fit the on the first layer of the RNN

Registered kernels:
  <no registered kernels>

	 [[cond_41/then/_0/cond/CudnnRNNV3]]
	 [[sequential/bidirectional/forward_gru/PartitionedCall]]
	 [[gradient_tape/sequential/embedding/embedding_lookup/Reshape/_60]]
  (1) Invalid argument:  No OpKernel was registered to support Op 'CudnnRNNV3' used by {{node cond_41/then/_0/cond/CudnnRNNV3}} with these attrs: [seed=0, dropout=0, T=DT_FLOAT, input_mode="linear_input", direction="unidirectional", rnn_mode="gru", seed2=0, is_training=true, num_proj=0, time_major=false]
Registered devices: [CPU, GPU]
Registered kernels:
  <no registered kernels>

	 [[cond_41/then/_0/cond/CudnnRNNV3]]
	 [[sequential/bidirectional/forward_gru/PartitionedCall]]
0 successful operations.
0 derived errors ignored. [Op:__inference_train_function_15394]

The related tensorflow versions are as follows

tensorflow-datasets==4.3.0
tensorflow-estimator==2.5.0
tensorflow-macos==2.5.0
tensorflow-metadata==1.1.0
tensorflow-metal==0.1.1

For further details, attached please find the full package requirements in the environment.

I have a same issue when using 'keras.layers.GRU' or 'keras.layers.LSTM'

it makes error "No OpKernel was registered to support Op 'CudnnRNNV3'"

==> In LSTM and GRU cases, it seems tensorflow uses cuDNN library when I use default setting(activation, recurrent_activation, recurrent_dropout, unroll ...). When I change the default setting like "keras.layers.GRU(32, activation = "elu")" the train worked well (but it is super slow).

Hi @gavinchan and @Myfriend, Thanks for reporting the issue. We were able to reproduce this issue locally and are working on providing the fix. It will be available as part of new version of TF-metal plugin and we will update it here.

The fix is now available. Please update to tensorflow-macos==2.6.0 and tensorflow-metal==0.2.0 to enable the CudnnRNNV3 op.

Failed to fit with the RNN layers
 
 
Q