Package ai.djl.basicmodelzoo.nlp
Class SimpleTextEncoder
- java.lang.Object
-
- ai.djl.nn.AbstractBaseBlock
-
- ai.djl.nn.AbstractBlock
-
- ai.djl.modality.nlp.Encoder
-
- ai.djl.basicmodelzoo.nlp.SimpleTextEncoder
-
- All Implemented Interfaces:
ai.djl.nn.Block
public class SimpleTextEncoder extends ai.djl.modality.nlp.EncoderSimpleTextEncoderimplements aEncoderthat employs aRecurrentBlockto encode text input.
-
-
Constructor Summary
Constructors Constructor Description SimpleTextEncoder(ai.djl.modality.nlp.embedding.TrainableTextEmbedding trainableTextEmbedding, ai.djl.nn.recurrent.RecurrentBlock recurrentBlock)Contructs a new instance ofSimpleTextEncoderwith the givenRecurrentBlockandTrainableTextEmbedding.SimpleTextEncoder(ai.djl.nn.recurrent.RecurrentBlock recurrentBlock)Contructs a new instance ofSimpleTextEncoderwith the givenRecurrentBlock.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ai.djl.ndarray.NDListgetStates(ai.djl.ndarray.NDList encoderOutput)-
Methods inherited from class ai.djl.modality.nlp.Encoder
forwardInternal, forwardInternal, getOutputShapes, initializeChildBlocks, loadParameters, saveParameters
-
Methods inherited from class ai.djl.nn.AbstractBlock
addChildBlock, addChildBlock, addChildBlockSingleton, addParameter, getChildren, getDirectParameters
-
Methods inherited from class ai.djl.nn.AbstractBaseBlock
beforeInitialize, cast, clear, describeInput, forward, forward, getInputShapes, getParameters, initialize, isInitialized, loadMetadata, prepare, readInputShapes, saveInputShapes, saveMetadata, setInitializer, setInitializer, setInitializer, toString
-
-
-
-
Constructor Detail
-
SimpleTextEncoder
public SimpleTextEncoder(ai.djl.nn.recurrent.RecurrentBlock recurrentBlock)
Contructs a new instance ofSimpleTextEncoderwith the givenRecurrentBlock. Use this constructor if you are planning to use pre-trained embeddings that don't need further training.- Parameters:
recurrentBlock- the recurrent block to be used to encode
-
SimpleTextEncoder
public SimpleTextEncoder(ai.djl.modality.nlp.embedding.TrainableTextEmbedding trainableTextEmbedding, ai.djl.nn.recurrent.RecurrentBlock recurrentBlock)Contructs a new instance ofSimpleTextEncoderwith the givenRecurrentBlockandTrainableTextEmbedding. Use this constructor if you are planning to use pre-trained or fresh embeddings that need further training.- Parameters:
trainableTextEmbedding- theTrainableTextEmbeddingto train embeddings withrecurrentBlock- the recurrent block to be used to encode
-
-