class_docstr: A sequence of modules with potentially inferring shape on construction.
  
  If layers are passed with names, these can be referenced with dot notation.
  
  Arguments
  ---------
  input_shape : iterable
      A list or tuple of ints or None, representing the expected shape of an
      input tensor. None represents a variable-length dimension. If no
      ``input_shape`` is passed, no shape inference will be performed.
  *layers, **named_layers
      The inputs are treated as a list of layers to be
      applied in sequence. The output shape of each layer is used to
      infer the shape of the following layer. If a tuple is returned,
      only the shape of the first element is used to determine input
      shape of the next layer (e.g. RNN returns output, hidden).
  
  Example
  -------
  >>> inputs = torch.rand(10, 40, 50)
  >>> model = Sequential(input_shape=inputs.shape)
  >>> model.append(Linear, n_neurons=100, layer_name="layer1")
  >>> model.append(Linear, n_neurons=200, layer_name="layer2")
  >>> outputs = model(inputs)
  >>> outputs.shape
  torch.Size([10, 40, 200])
  >>> outputs = model.layer1(inputs)
  >>> outputs.shape
  torch.Size([10, 40, 100])
code: def __init__(self, *layers, input_shape=None, **named_layers):
      super().__init__()
  
      # Make sure either layers or input_shape is passed
      if not layers and input_shape is None and not named_layers:
          raise ValueError("Must pass either layers or input shape")
  
      # Keep track of what layers need "lengths" passed
      self.length_layers = []
  
      # Replace None dimensions with arbitrary value
      self.input_shape = input_shape
      if input_shape and None in input_shape:
          self.input_shape = list(input_shape)
          for i, dim in enumerate(self.input_shape):
              # To reduce size of dummy tensors, use 1 for batch dim
              if i == 0 and dim is None:
                  dim = 1
  
              # Use 64 as nice round arbitrary value, big enough that
              # halving this dimension a few times doesn't reach 1
              self.input_shape[i] = dim or 256
  
      # Append non-named layers
      for layer in layers:
          self.append(layer)
  
      # Append named layers
      for name, layer in named_layers.items():
          self.append(layer, layer_name=name)
  
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 Sequential object from inherited base classes: torch.nn with example: obj = Sequential()