Class SequentialBlock

java.lang.Object
smile.deep.layer.LayerBlock
smile.deep.layer.SequentialBlock
All Implemented Interfaces:
Function<Tensor,Tensor>, Layer
Direct Known Subclasses:
Conv2dNormActivation

public class SequentialBlock extends LayerBlock
A block of sequential layers. Layers will be added to it in the order they are passed in the constructor. The forward() method of SequentialBlock accepts any input and forwards it to the first layer it contains. It then "chains" outputs to inputs sequentially for each subsequent module, finally returning the output of the last layer.
  • Constructor Details

    • SequentialBlock

      public SequentialBlock()
      Constructor.
    • SequentialBlock

      public SequentialBlock(String name)
      Constructor.
      Parameters:
      name - the module name.
    • SequentialBlock

      public SequentialBlock(Layer... layers)
      Constructor.
      Parameters:
      layers - the neural network layers.
  • Method Details

    • add

      public SequentialBlock add(Layer layer)
      Adds a layer to the sequential block.
      Parameters:
      layer - a layer.
      Returns:
      this object.
    • forward

      public Tensor forward(Tensor input)
      Description copied from interface: Layer
      Forward propagation (or forward pass) through the layer.
      Parameters:
      input - the input tensor.
      Returns:
      the output tensor.