docstr: PyTorch module implementing an RNN to be used in `RNNModel`.
  
  PyTorch module implementing a simple RNN with the specified `name` type.
  This module combines a PyTorch RNN module, together with one fully connected layer which
  maps the hidden state of the RNN at each step to the output value of the model at that
  time step.
  
  Parameters
  ----------
  name
      The name of the specific PyTorch RNN module ("RNN", "GRU" or "LSTM").
  **kwargs
      all parameters required for the :class:`darts.model.forecasting_models.CustomRNNModule` base class.
  
  Inputs
  ------
  x of shape `(batch_size, input_length, input_size)`
      Tensor containing the features of the input sequence. The `input_length` is not fixed.
  
  Outputs
  -------
  y of shape `(batch_size, output_chunk_length, target_size, nr_params)`
      Tensor containing the outputs of the RNN at every time step of the input sequence.
      During training the whole tensor is used as output, whereas during prediction we only use y[:, -1, :].
      However, this module always returns the whole Tensor.
docstr_tok: ["PyTorch","module","implementing","an","RNN","to","be","used","in","`","RNNModel","`",".","PyTorch","module","implementing","a","simple","RNN","with","the","specified","`","name","`","type",".","This","module","combines","a","PyTorch","RNN","module",",","together","with","one","fully","connected","layer","which","maps","the","hidden","state","of","the","RNN","at","each","step","to","the","output","value","of","the","model","at","that","time","step",".","Parameters","--","--","--","--","--","name","The","name","of","the","specific","PyTorch","RNN","module","(","``","RNN","''",",","``","GRU","''","or","``","LSTM","''",")",".","*","*","kwargs","all","parameters","required","for","the",":","class",":","`","darts.model.forecasting_models.CustomRNNModule","`","base","class",".","Inputs","--","--","--","x","of","shape","`","(","batch_size",",","input_length",",","input_size",")","`","Tensor","containing","the","features","of","the","input","sequence",".","The","`","input_length","`","is","not","fixed",".","Outputs","--","--","--","-","y","of","shape","`","(","batch_size",",","output_chunk_length",",","target_size",",","nr_params",")","`","Tensor","containing","the","outputs","of","the","RNN","at","every","time","step","of","the","input","sequence",".","During","training","the","whole","tensor","is","used","as","output",",","whereas","during","prediction","we","only","use","y","[",":",",","-1",",",":","]",".","However",",","this","module","always","returns","the","whole","Tensor","."]
code: def __init__(
      self,
      name: str,
      **kwargs,
  ):
      """PyTorch module implementing an RNN to be used in `RNNModel`.
  
      PyTorch module implementing a simple RNN with the specified `name` type.
      This module combines a PyTorch RNN module, together with one fully connected layer which
      maps the hidden state of the RNN at each step to the output value of the model at that
      time step.
  
      Parameters
      ----------
      name
          The name of the specific PyTorch RNN module ("RNN", "GRU" or "LSTM").
      **kwargs
          all parameters required for the :class:`darts.model.forecasting_models.CustomRNNModule` base class.
  
      Inputs
      ------
      x of shape `(batch_size, input_length, input_size)`
          Tensor containing the features of the input sequence. The `input_length` is not fixed.
  
      Outputs
      -------
      y of shape `(batch_size, output_chunk_length, target_size, nr_params)`
          Tensor containing the outputs of the RNN at every time step of the input sequence.
          During training the whole tensor is used as output, whereas during prediction we only use y[:, -1, :].
          However, this module always returns the whole Tensor.
      """
  
      # RNNModule doesn't really need input and output_chunk_length for PLModule
      super().__init__(**kwargs)
      self.name = name
  
      # Defining the RNN module
      self.rnn = getattr(nn, name)(
          self.input_size,
          self.hidden_dim,
          self.num_layers,
          batch_first=True,
          dropout=self.dropout,
      )
  
      # The RNN module needs a linear layer V that transforms hidden states into outputs, individually
      self.V = nn.Linear(
          self.hidden_dim, self.target_size * self.nr_params
      )
  
imports: import inspect
  from abc import ABC, abstractmethod
  from typing import Optional, Sequence, Tuple, Type, Union
  import torch
  import torch.nn
  from darts.logging import get_logger, raise_if_not, raise_log
  from darts.models.forecasting.pl_forecasting_module import PLDualCovariatesModule, io_processor
  from darts.models.forecasting.torch_forecasting_model import DualCovariatesTorchModel
  from darts.timeseries import TimeSeries
  from darts.utils.data import DualCovariatesShiftedDataset, TrainingDataset
label_desc: Use image node_id 1 to create a new _RNNModule object from inherited base classes: CustomRNNModule with example: obj = _RNNModule(name)