Package ai.djl.nn.recurrent
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
FieldsModifier and TypeFieldDescriptionprotected RNN.Activation
protected boolean
protected boolean
protected float
protected boolean
protected int
protected boolean
protected long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionoptBatchFirst
(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
self()
setNumLayers
(int numLayers) Sets the Required number of stacked layers.setStateSize
(int stateSize) Sets the Required size of the state for each layer.
-
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
-
-
Constructor Details
-
BaseBuilder
public BaseBuilder()
-
-
Method Details
-
optDropRate
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
Sets the Required size of the state for each layer.- Parameters:
stateSize
- the size of the state for each layer- Returns:
- this Builder
-
setNumLayers
Sets the Required number of stacked layers.- Parameters:
numLayers
- the number of stacked layers- Returns:
- this Builder
-
optBidirectional
Sets the optional parameter that indicates whether to use bidirectional recurrent layers.- Parameters:
useBidirectional
- whether to use bidirectional recurrent layers- Returns:
- this Builder
-
optBatchFirst
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
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
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
-