docstr: This class allows to create custom block RNN modules that can later be used with Darts'
  :class:`BlockRNNModel`. It adds the backbone that is required to be used with Darts'
  :class:`TorchForecastingModel` and :class:`BlockRNNModel`.
  
  To create a new module, subclass from :class:`CustomBlockRNNModule` and:
  
  * Define the architecture in the module constructor (`__init__()`)
  
  * Add the `forward()` method and define the logic of your module's forward pass
  
  * Use the custom module class when creating a new :class:`BlockRNNModel` with parameter `model`.
  
  You can use `darts.models.forecasting.block_rnn_model._BlockRNNModule` as an example.
  
  Parameters
  ----------
  input_size
      The dimensionality of the input time series.
  hidden_dim
      The number of features in the hidden state `h` of the RNN module.
  num_layers
      The number of recurrent layers.
  target_size
      The dimensionality of the output time series.
  nr_params
      The number of parameters of the likelihood (or 1 if no likelihood is used).
  num_layers_out_fc
      A list containing the dimensions of the hidden layers of the fully connected NN.
      This network connects the last hidden layer of the PyTorch RNN module to the output.
  dropout
      The fraction of neurons that are dropped in all-but-last RNN layers.
  **kwargs
      all parameters required for :class:`darts.model.forecasting_models.PLForecastingModule` base class.
docstr_tok: ["This","class","allows","to","create","custom","block","RNN","modules","that","can","later","be","used","with","Darts'",":","class",":","`","BlockRNNModel","`",".","It","adds","the","backbone","that","is","required","to","be","used","with","Darts'",":","class",":","`","TorchForecastingModel","`","and",":","class",":","`","BlockRNNModel","`",".","To","create","a","new","module",",","subclass","from",":","class",":","`","CustomBlockRNNModule","`","and",":","*","Define","the","architecture","in","the","module","constructor","(","`","__init__","(",")","`",")","*","Add","the","`","forward","(",")","`","method","and","define","the","logic","of","your","module","'s","forward","pass","*","Use","the","custom","module","class","when","creating","a","new",":","class",":","`","BlockRNNModel","`","with","parameter","`","model","`",".","You","can","use","`","darts.models.forecasting.block_rnn_model._BlockRNNModule","`","as","an","example",".","Parameters","--","--","--","--","--","input_size","The","dimensionality","of","the","input","time","series",".","hidden_dim","The","number","of","features","in","the","hidden","state","`","h","`","of","the","RNN","module",".","num_layers","The","number","of","recurrent","layers",".","target_size","The","dimensionality","of","the","output","time","series",".","nr_params","The","number","of","parameters","of","the","likelihood","(","or","1","if","no","likelihood","is","used",")",".","num_layers_out_fc","A","list","containing","the","dimensions","of","the","hidden","layers","of","the","fully","connected","NN",".","This","network","connects","the","last","hidden","layer","of","the","PyTorch","RNN","module","to","the","output",".","dropout","The","fraction","of","neurons","that","are","dropped","in","all-but-last","RNN","layers",".","*","*","kwargs","all","parameters","required","for",":","class",":","`","darts.model.forecasting_models.PLForecastingModule","`","base","class","."]
code: def __init__(
      self,
      input_size: int,
      hidden_dim: int,
      num_layers: int,
      target_size: int,
      nr_params: int,
      num_layers_out_fc: Optional[List] = None,
      dropout: float = 0.0,
      **kwargs,
  ):
      """This class allows to create custom block RNN modules that can later be used with Darts'
      :class:`BlockRNNModel`. It adds the backbone that is required to be used with Darts'
      :class:`TorchForecastingModel` and :class:`BlockRNNModel`.
  
      To create a new module, subclass from :class:`CustomBlockRNNModule` and:
  
      * Define the architecture in the module constructor (`__init__()`)
  
      * Add the `forward()` method and define the logic of your module's forward pass
  
      * Use the custom module class when creating a new :class:`BlockRNNModel` with parameter `model`.
  
      You can use `darts.models.forecasting.block_rnn_model._BlockRNNModule` as an example.
  
      Parameters
      ----------
      input_size
          The dimensionality of the input time series.
      hidden_dim
          The number of features in the hidden state `h` of the RNN module.
      num_layers
          The number of recurrent layers.
      target_size
          The dimensionality of the output time series.
      nr_params
          The number of parameters of the likelihood (or 1 if no likelihood is used).
      num_layers_out_fc
          A list containing the dimensions of the hidden layers of the fully connected NN.
          This network connects the last hidden layer of the PyTorch RNN module to the output.
      dropout
          The fraction of neurons that are dropped in all-but-last RNN layers.
      **kwargs
          all parameters required for :class:`darts.model.forecasting_models.PLForecastingModule` base class.
      """
      super().__init__(**kwargs)
  
      # Defining parameters
      self.input_size = input_size
      self.hidden_dim = hidden_dim
      self.num_layers = num_layers
      self.target_size = target_size
      self.nr_params = nr_params
      self.num_layers_out_fc = (
          [] if num_layers_out_fc is None else num_layers_out_fc
      )
      self.dropout = dropout
      self.out_len = self.output_chunk_length
  
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 CustomBlockRNNModule object from inherited base classes: PLPastCovariatesModule, ABC with example: obj = CustomBlockRNNModule(input_size, hidden_dim, num_layers, target_size, nr_params, num_layers_out_fc, dropout)