Class RecurrentBlock.BaseBuilder<T extends RecurrentBlock.BaseBuilder>

java.lang.Object
ai.djl.nn.recurrent.RecurrentBlock.BaseBuilder<T>
Direct Known Subclasses:
GRU.Builder, LSTM.Builder, RNN.Builder
Enclosing class:
RecurrentBlock

public abstract static class RecurrentBlock.BaseBuilder<T extends RecurrentBlock.BaseBuilder> extends Object
The Builder to construct a RecurrentBlock type of Block.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected RNN.Activation
     
    protected boolean
     
    protected boolean
     
    protected float
     
    protected boolean
     
    protected int
     
    protected boolean
     
    protected long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    optBatchFirst(boolean batchFirst)
    Sets the optional batchFirst flag that indicates whether the input is batch major or not.
    optBidirectional(boolean useBidirectional)
    Sets the optional parameter that indicates whether to use bidirectional recurrent layers.
    optDropRate(float dropRate)
    Sets the drop rate of the dropout on the outputs of each RNN layer, except the last layer.
    optHasBiases(boolean hasBiases)
    Sets the optional biases flag that indicates whether to use biases or not.
    optReturnState(boolean returnState)
    Sets the optional flag that indicates whether to return state or not.
    protected abstract T
     
    setNumLayers(int numLayers)
    Sets the Required number of stacked layers.
    setStateSize(int stateSize)
    Sets the Required size of the state for each layer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • dropRate

      protected float dropRate
    • stateSize

      protected long stateSize
    • numLayers

      protected int numLayers
    • batchFirst

      protected boolean batchFirst
    • hasBiases

      protected boolean hasBiases
    • bidirectional

      protected boolean bidirectional
    • returnState

      protected boolean returnState
    • activation

      protected RNN.Activation activation
  • Constructor Details

    • BaseBuilder

      public BaseBuilder()
  • Method Details

    • optDropRate

      public T optDropRate(float dropRate)
      Sets the drop rate of the dropout on the outputs of each RNN layer, except the last layer.
      Parameters:
      dropRate - the drop rate of the dropout
      Returns:
      this Builder
    • setStateSize

      public T setStateSize(int stateSize)
      Sets the Required size of the state for each layer.
      Parameters:
      stateSize - the size of the state for each layer
      Returns:
      this Builder
    • setNumLayers

      public T setNumLayers(int numLayers)
      Sets the Required number of stacked layers.
      Parameters:
      numLayers - the number of stacked layers
      Returns:
      this Builder
    • optBidirectional

      public T optBidirectional(boolean useBidirectional)
      Sets the optional parameter that indicates whether to use bidirectional recurrent layers.
      Parameters:
      useBidirectional - whether to use bidirectional recurrent layers
      Returns:
      this Builder
    • optBatchFirst

      public T optBatchFirst(boolean batchFirst)
      Sets the optional batchFirst flag that indicates whether the input is batch major or not. The default value is true.
      Parameters:
      batchFirst - whether the input is batch major or not
      Returns:
      this Builder
    • optHasBiases

      public T optHasBiases(boolean hasBiases)
      Sets the optional biases flag that indicates whether to use biases or not.
      Parameters:
      hasBiases - whether to use biases or not
      Returns:
      this Builder
    • optReturnState

      public T optReturnState(boolean returnState)
      Sets the optional flag that indicates whether to return state or not. This is typically useful when you use RecurrentBlock in Sequential block. The default value is false.
      Parameters:
      returnState - whether to return state or not
      Returns:
      this Builder
    • self

      protected abstract T self()