docstr: PyTorch module implementing a block RNN to be used in `BlockRNNModel`.
  
  PyTorch module implementing a simple block RNN with the specified `name` layer.
  This module combines a PyTorch RNN module, together with a fully connected network, which maps the
  last hidden layers to output of the desired size `output_chunk_length` and makes it compatible with
  `BlockRNNModel`s.
  
  This module uses an RNN to encode the input sequence, and subsequently uses a fully connected
  network as the decoder which takes as input the last hidden state of the encoder RNN.
  The final output of the decoder is a sequence of length `output_chunk_length`. In this sense,
  the `_BlockRNNModule` produces 'blocks' of forecasts at a time (which is different
  from `_RNNModule` used by the `RNNModel`).
  
  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.CustomBlockRNNModule` base class.
  
  Inputs
  ------
  x of shape `(batch_size, input_chunk_length, input_size, nr_params)`
      Tensor containing the features of the input sequence.
  
  Outputs
  -------
  y of shape `(batch_size, output_chunk_length, target_size, nr_params)`
      Tensor containing the prediction at the last time step of the sequence.
docstr_tok: ["PyTorch","module","implementing","a","block","RNN","to","be","used","in","`","BlockRNNModel","`",".","PyTorch","module","implementing","a","simple","block","RNN","with","the","specified","`","name","`","layer",".","This","module","combines","a","PyTorch","RNN","module",",","together","with","a","fully","connected","network",",","which","maps","the","last","hidden","layers","to","output","of","the","desired","size","`","output_chunk_length","`","and","makes","it","compatible","with","`","BlockRNNModel","`","s",".","This","module","uses","an","RNN","to","encode","the","input","sequence",",","and","subsequently","uses","a","fully","connected","network","as","the","decoder","which","takes","as","input","the","last","hidden","state","of","the","encoder","RNN",".","The","final","output","of","the","decoder","is","a","sequence","of","length","`","output_chunk_length","`",".","In","this","sense",",","the","`","_BlockRNNModule","`","produces","'blocks","'","of","forecasts","at","a","time","(","which","is","different","from","`","_RNNModule","`","used","by","the","`","RNNModel","`",")",".","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.CustomBlockRNNModule","`","base","class",".","Inputs","--","--","--","x","of","shape","`","(","batch_size",",","input_chunk_length",",","input_size",",","nr_params",")","`","Tensor","containing","the","features","of","the","input","sequence",".","Outputs","--","--","--","-","y","of","shape","`","(","batch_size",",","output_chunk_length",",","target_size",",","nr_params",")","`","Tensor","containing","the","prediction","at","the","last","time","step","of","the","sequence","."]
code: def __init__(
      self,
      name: str,
      **kwargs,
  ):
      """PyTorch module implementing a block RNN to be used in `BlockRNNModel`.
  
      PyTorch module implementing a simple block RNN with the specified `name` layer.
      This module combines a PyTorch RNN module, together with a fully connected network, which maps the
      last hidden layers to output of the desired size `output_chunk_length` and makes it compatible with
      `BlockRNNModel`s.
  
      This module uses an RNN to encode the input sequence, and subsequently uses a fully connected
      network as the decoder which takes as input the last hidden state of the encoder RNN.
      The final output of the decoder is a sequence of length `output_chunk_length`. In this sense,
      the `_BlockRNNModule` produces 'blocks' of forecasts at a time (which is different
      from `_RNNModule` used by the `RNNModel`).
  
      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.CustomBlockRNNModule` base class.
  
      Inputs
      ------
      x of shape `(batch_size, input_chunk_length, input_size, nr_params)`
          Tensor containing the features of the input sequence.
  
      Outputs
      -------
      y of shape `(batch_size, output_chunk_length, target_size, nr_params)`
          Tensor containing the prediction at the last time step of the sequence.
      """
  
      super().__init__(**kwargs)
  
      self.name = name
  
      # Defining the RNN module
      self.rnn = getattr(nn, self.name)(
          self.input_size,
          self.hidden_dim,
          self.num_layers,
          batch_first=True,
          dropout=self.dropout,
      )
  
      # The RNN module is followed by a fully connected layer, which maps the last hidden layer
      # to the output of desired length
      last = self.hidden_dim
      feats = []
      for feature in self.num_layers_out_fc + [
          self.out_len * self.target_size * self.nr_params
      ]:
          feats.append(nn.Linear(last, feature))
          last = feature
      self.fc = nn.Sequential(*feats)
  
imports: import inspect
  from abc import ABC, abstractmethod
  from typing import List, Optional, Tuple, Type, Union
  import torch
  import torch.nn
  from darts.logging import get_logger, raise_log
  from darts.models.forecasting.pl_forecasting_module import PLPastCovariatesModule, io_processor
  from darts.models.forecasting.torch_forecasting_model import PastCovariatesTorchModel
label_desc: Use image node_id 1 to create a new _BlockRNNModule object from inherited base classes: CustomBlockRNNModule with example: obj = _BlockRNNModule(name)