Package ai.djl.basicmodelzoo.nlp
Class SimpleTextDecoder
- java.lang.Object
-
- ai.djl.nn.AbstractBlock
-
- ai.djl.modality.nlp.Decoder
-
- ai.djl.basicmodelzoo.nlp.SimpleTextDecoder
-
- All Implemented Interfaces:
ai.djl.nn.Block
public class SimpleTextDecoder extends ai.djl.modality.nlp.DecoderSimpleTextDecoderimplements aDecoderthat employs aRecurrentBlockto decode text input.
-
-
Constructor Summary
Constructors Constructor Description SimpleTextDecoder(ai.djl.modality.nlp.embedding.TrainableTextEmbedding trainableTextEmbedding, ai.djl.nn.recurrent.RecurrentBlock recurrentBlock, long vocabSize)Contructs a new instance ofSimpleTextDecoderwith the givenRecurrentBlock.SimpleTextDecoder(ai.djl.nn.recurrent.RecurrentBlock recurrentBlock, int vocabSize)Contructs a new instance ofSimpleTextDecoderwith the givenRecurrentBlock.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ai.djl.ndarray.NDListforwardInternal(ai.djl.training.ParameterStore parameterStore, ai.djl.ndarray.NDList inputs, boolean training, ai.djl.util.PairList<java.lang.String,java.lang.Object> params)-
Methods inherited from class ai.djl.modality.nlp.Decoder
getOutputShapes, initializeChildBlocks, loadParameters, saveParameters
-
Methods inherited from class ai.djl.nn.AbstractBlock
addChildBlock, addParameter, beforeInitialize, cast, clear, describeInput, forward, forward, forwardInternal, getChildren, getDirectParameters, getParameters, initialize, isInitialized, loadMetadata, prepare, readInputShapes, saveInputShapes, saveMetadata, setInitializer, setInitializer, setInitializer, toString
-
-
-
-
Constructor Detail
-
SimpleTextDecoder
public SimpleTextDecoder(ai.djl.nn.recurrent.RecurrentBlock recurrentBlock, int vocabSize)Contructs a new instance ofSimpleTextDecoderwith 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 decodevocabSize- the size of theVocabulary
-
SimpleTextDecoder
public SimpleTextDecoder(ai.djl.modality.nlp.embedding.TrainableTextEmbedding trainableTextEmbedding, ai.djl.nn.recurrent.RecurrentBlock recurrentBlock, long vocabSize)Contructs a new instance ofSimpleTextDecoderwith the givenRecurrentBlock. Use this constructor if you are planning to use pre-trained embeddings that don't need further training.- Parameters:
trainableTextEmbedding- theTrainableTextEmbeddingto train embeddings withrecurrentBlock- the recurrent block to be used to decodevocabSize- the size of theVocabulary
-
-
Method Detail
-
forwardInternal
protected ai.djl.ndarray.NDList forwardInternal(ai.djl.training.ParameterStore parameterStore, ai.djl.ndarray.NDList inputs, boolean training, ai.djl.util.PairList<java.lang.String,java.lang.Object> params)- Overrides:
forwardInternalin classai.djl.modality.nlp.Decoder
-
-