class_docstr: Connect a sequence of blocks with shortcut connections.
  
  Note: all shortcuts start from the output of the first block,
  since the first block may change the shape significantly.
  
  Arguments
  ---------
  input_shape : tuple
      The shape of the
  shortcut_type : str
      One of:
      * "residual" - first block output passed to final output,
      * "dense" - input of each block is from all previous blocks,
      * "skip" - output of each block is passed to final output.
  shortcut_projection : bool
      Only has an effect if `shortcut_type` is passed. Whether to add a
      linear projection layer to the shortcut connection before combining
      with the output, to handle different sizes.
  shortcut_combine_fn : str or function
      Either a pre-defined function (one of "add", "sub", "mul", "div",
      "avg", "cat") or a user-defined function that takes the shortcut
      and next input, and combines them, as well as `init_params`
      in case parameters need to be initialized inside of the function.
  
  Example
  -------
  >>> inputs = torch.rand(10, 100, 20)
  >>> model = ConnectBlocks(
  ...     input_shape=inputs.shape, shortcut_projection=True
  ... )
  >>> model.append(Linear, n_neurons=10)
  >>> model.append(Linear, n_neurons=10, end_of_block=True)
  >>> model.append(Linear, n_neurons=10)
  >>> model.append(Linear, n_neurons=10, end_of_block=True)
  >>> outputs = model(inputs)
  >>> outputs.shape
  torch.Size([10, 100, 10])
code: def __init__(
      self,
      input_shape,
      shortcut_type="residual",
      shortcut_projection=False,
      shortcut_combine_fn=torch.add,
  ):
      super().__init__()
  
      self.first_input_shape = input_shape
      self.block_input_shape = input_shape
      self.new_block = True
      self.blocks = torch.nn.ModuleList()
      if shortcut_type not in ["residual", "dense", "skip"]:
          raise ValueError(
              "'shortcuts' must be one of 'residual', 'dense', or 'skip'"
          )
      self.shortcut_type = shortcut_type
      self.shortcut_projection = shortcut_projection
      if shortcut_projection:
          self.projections = torch.nn.ModuleList()
      self.shortcut_combine_fn = shortcut_combine_fn
  
imports: import torch
  import inspect
  import logging
  import operator
  import functools
  from speechbrain.nnet.linear import Linear
  from speechbrain.utils.callchains import lengths_arg_exists
label_desc: Use image node_id 1 to create a new ConnectBlocks object from inherited base classes: torch.nn with example: obj = ConnectBlocks(input_shape, shortcut_type, shortcut_projection, shortcut_combine_fn)