code: def new_rnn(cfg, layer_num):
      use_cudnnlstm = (
          K.backend() == "tensorflow"
          and len(config.get_visible_devices("GPU")) > 0
      )
      if use_cudnnlstm:
          if cfg["rnn_bidirectional"]:
              return Bidirectional(
                  LSTM(cfg["rnn_size"], return_sequences=True),
                  name="rnn_{}".format(layer_num),
              )
  
          return LSTM(
              cfg["rnn_size"],
              return_sequences=True,
              name="rnn_{}".format(layer_num),
          )
      else:
          if cfg["rnn_bidirectional"]:
              return Bidirectional(
                  LSTM(
                      cfg["rnn_size"],
                      return_sequences=True,
                      recurrent_activation="sigmoid",
                  ),
                  name="rnn_{}".format(layer_num),
              )
  
          return LSTM(
              cfg["rnn_size"],
              return_sequences=True,
              recurrent_activation="sigmoid",
              name="rnn_{}".format(layer_num),
          )
  
file_path: textgenrnn/textgenrnn/model.py
imports: from tensorflow.keras.optimizers import Adam
  from tensorflow.keras.layers import Input, Embedding, Dense, LSTM, Bidirectional
  from tensorflow.keras.layers import concatenate, Reshape, SpatialDropout1D
  from tensorflow.keras.models import Model
  from tensorflow.keras import backend
  from tensorflow import config
  from .AttentionWeightedAverage import AttentionWeightedAverage
label_desc: Use image node_id 2 for calling a global function with example usage: new_rnn(cfg, layer_num) and returns: LSTM, LSTM, Bidirectional, Bidirectional