title: using cuDNN kernel for LSTM
body: <p>I want to train my RNN model using Cudnn:</p>
  
  <pre><code>max_length &lt;- 140 
  embedding_dim &lt;- 128
  
  model &lt;- keras_model_sequential()
  
  # define model
  model %&gt;% 
    # layer input
    layer_embedding(
      name = "input",
      input_dim = num_words,
      input_length = max_length,
      output_dim = embedding_dim, 
      embeddings_initializer = initializer_random_uniform(minval = -0.05, maxval = 0.05, seed = 2)
    ) %&gt;%
    # layer dropout
    layer_spatial_dropout_1d(
      name = "embedding_dropout",
      rate = 0.2
    ) %&gt;%
    # layer lstm 1
    bidirectional(layer_lstm(
      name = "lstm",
      units = 64,
      unroll = FALSE,
      dropout = 0.2,
      use_bias = TRUE,
      recurrent_dropout = 0,
      return_sequences = TRUE
    )) %&gt;% 
    layer_batch_normalization() %&gt;%
    # layer output
    layer_dense(
      name = "output",
      units = 3,
      activation = "softmax"
    )
  </code></pre>
  
  <p>when I run this I get this warming:</p>
  
  <blockquote>
    <p>WARNING:tensorflow:Layer lstm will not use cuDNN kernel since it
    doesn't meet the cuDNN kernel criteria. It will use generic GPU kernel
    as fallback when running on GPU</p>
  </blockquote>
  
  <p>I think I have followed all the <a href="https://www.tensorflow.org/guide/keras/rnn#performance_optimization_and_cudnn_kernels_in_tensorflow_20" rel="noreferrer">requirements</a>, not sure what I'm missing. </p>
  
  <p>SessionInfo:</p>
  
  <pre><code>R version 4.0.0 (2020-04-24)
  Platform: x86_64-w64-mingw32/x64 (64-bit)
  Running under: Windows 10 x64 (build 18363)
  
  Matrix products: default
  
  locale:
  [1] LC_COLLATE=English_United States.1252 
  [2] LC_CTYPE=English_United States.1252   
  [3] LC_MONETARY=English_United States.1252
  [4] LC_NUMERIC=C                          
  [5] LC_TIME=English_United States.1252    
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] keras_2.3.0.0
  
  loaded via a namespace (and not attached):
   [1] Rcpp_1.0.4.6     lattice_0.20-41  zeallot_0.1.0    rappdirs_0.3.1  
   [5] grid_4.0.0       R6_2.4.1         jsonlite_1.6.1   magrittr_1.5    
   [9] tfruns_1.4       whisker_0.4      Matrix_1.2-18    reticulate_1.15 
  [13] generics_0.0.2   tools_4.0.0      xfun_0.14        compiler_4.0.0  
  [17] base64enc_0.1-3  tensorflow_2.2.0 knitr_1.28   
  </code></pre>