Package ai.djl.basicmodelzoo.nlp
Class SimpleTextDecoder
- java.lang.Object
-
- ai.djl.nn.AbstractBaseBlock
-
- 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.Decoder
SimpleTextDecoder
implements aDecoder
that employs aRecurrentBlock
to 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 ofSimpleTextDecoder
with the givenRecurrentBlock
.SimpleTextDecoder(ai.djl.nn.recurrent.RecurrentBlock recurrentBlock, int vocabSize)
Contructs a new instance ofSimpleTextDecoder
with the givenRecurrentBlock
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
-
Methods inherited from class ai.djl.modality.nlp.Decoder
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, forwardInternal, getInputShapes, getOutputDataTypes, 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 ofSimpleTextDecoder
with 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 ofSimpleTextDecoder
with the givenRecurrentBlock
. Use this constructor if you are planning to use pre-trained embeddings that don't need further training.- Parameters:
trainableTextEmbedding
- theTrainableTextEmbedding
to 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:
forwardInternal
in classai.djl.modality.nlp.Decoder
-
-