class_docstr: Implementation of recurrent layers.
class_docstr_tok: ["Implementation","of","recurrent","layers","."]
code: def __init__(
      self,
      hidden_size,
      num_layers,
      layout,
      dropout,
      bidirectional,
      input_size,
      i2h_weight_initializer,
      h2h_weight_initializer,
      i2h_bias_initializer,
      h2h_bias_initializer,
      mode,
      projection_size,
      h2r_weight_initializer,
      lstm_state_clip_min,
      lstm_state_clip_max,
      lstm_state_clip_nan,
      dtype,
      use_sequence_length=False,
      **kwargs,
  ):
      super(_RNNLayer, self).__init__(**kwargs)
      assert layout in (
          "TNC",
          "NTC",
      ), f"Invalid layout {layout}; must be one of ['TNC' or 'NTC']"
      self._hidden_size = hidden_size
      self._projection_size = (
          projection_size if projection_size else None
      )
      self._num_layers = num_layers
      self._mode = mode
      self._layout = layout
      self._dropout = dropout
      self._dir = 2 if bidirectional else 1
      self._input_size = input_size
      self._lstm_state_clip_min = lstm_state_clip_min
      self._lstm_state_clip_max = lstm_state_clip_max
      self._lstm_state_clip_nan = lstm_state_clip_nan
      self._dtype = dtype
      self._use_sequence_length = use_sequence_length
      self.skip_states = None
  
      self._gates = {"rnn_relu": 1, "rnn_tanh": 1, "lstm": 4, "gru": 3}[
          mode
      ]
  
      param_initializer = initializer.RNNFused(
          mode,
          num_layers,
          hidden_size,
          bidirectional,
          projection_size,
          i2h_weight_initializer=i2h_weight_initializer,
          h2h_weight_initializer=h2h_weight_initializer,
          i2h_bias_initializer=i2h_bias_initializer,
          h2h_bias_initializer=h2h_bias_initializer,
          h2r_weight_initializer=h2r_weight_initializer,
      )
  
      self.rnn_param = Parameter(
          "rnn_param",
          shape=(-1,),
          init=param_initializer,
          allow_deferred_init=True,
          dtype=dtype,
      )
  
imports: from ...None import np, npx, initializer, cpu
  from ..None import HybridBlock, tensor_types
  from ..parameter import Parameter
  from ...util import use_np
label_desc: Use image node_id 1 to create a new _RNNLayer object from inherited base classes: HybridBlock with example: obj = _RNNLayer(hidden_size, num_layers, layout, dropout, bidirectional, input_size, i2h_weight_initializer, h2h_weight_initializer, i2h_bias_initializer, h2h_bias_initializer, mode, projection_size, h2r_weight_initializer, lstm_state_clip_min, lstm_state_clip_max, lstm_state_clip_nan, dtype, use_sequence_length)