class_docstr: Defines an RNN block.
  
  Parameters
  ----------
  mode
      type of the RNN. Can be either: rnn_relu (RNN with relu activation),
      rnn_tanh, (RNN with tanh activation), lstm or gru.
  
  num_hidden
      number of units per hidden layer.
  
  num_layers
      number of hidden layers.
  
  bidirectional
      toggle use of bi-directional RNN as encoder.
class_docstr_tok: ["Defines","an","RNN","block",".","Parameters","--","--","--","--","--","mode","type","of","the","RNN",".","Can","be","either",":","rnn_relu","(","RNN","with","relu","activation",")",",","rnn_tanh",",","(","RNN","with","tanh","activation",")",",","lstm","or","gru",".","num_hidden","number","of","units","per","hidden","layer",".","num_layers","number","of","hidden","layers",".","bidirectional","toggle","use","of","bi-directional","RNN","as","encoder","."]
code: def __init__(
      self,
      mode: str,
      num_hidden: int,
      num_layers: int,
      bidirectional: bool = False,
      **kwargs,
  ):
      super().__init__(**kwargs)
  
      with self.name_scope():
          if mode == "rnn_relu":
              self.rnn = rnn.RNN(
                  num_hidden,
                  num_layers,
                  bidirectional=bidirectional,
                  activation="relu",
                  layout="NTC",
              )
          elif mode == "rnn_tanh":
              self.rnn = rnn.RNN(
                  num_hidden,
                  num_layers,
                  bidirectional=bidirectional,
                  layout="NTC",
              )
          elif mode == "lstm":
              self.rnn = rnn.LSTM(
                  num_hidden,
                  num_layers,
                  bidirectional=bidirectional,
                  layout="NTC",
              )
          elif mode == "gru":
              self.rnn = rnn.GRU(
                  num_hidden,
                  num_layers,
                  bidirectional=bidirectional,
                  layout="NTC",
              )
          else:
              raise ValueError(
                  "Invalid mode %s. Options are rnn_relu, rnn_tanh, lstm,"
                  " and gru " % mode
              )
  
imports: from mxnet.gluon import HybridBlock, rnn
  from gluonts.core.component import validated
  from gluonts.mx import Tensor
label_desc: Use image node_id 1 to create a new RNN object from inherited base classes: HybridBlock with example: obj = RNN(mode, num_hidden, num_layers, bidirectional)