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 a Decoder that employs a RecurrentBlock to
decode text input.-
Field Summary
Fields inherited from class ai.djl.modality.nlp.Decoder
blockFields inherited from class ai.djl.nn.AbstractBlock
children, parametersFields inherited from class ai.djl.nn.AbstractBaseBlock
inputNames, inputShapes, outputDataTypes, version -
Constructor Summary
ConstructorsConstructorDescriptionSimpleTextDecoder(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
Modifier and TypeMethodDescriptionprotected ai.djl.ndarray.NDListforwardInternal(ai.djl.training.ParameterStore parameterStore, ai.djl.ndarray.NDList inputs, boolean training, ai.djl.util.PairList<String, Object> params) Methods inherited from class ai.djl.modality.nlp.Decoder
getOutputShapes, initializeChildBlocks, loadParameters, saveParametersMethods inherited from class ai.djl.nn.AbstractBlock
addChildBlock, addChildBlock, addChildBlockSingleton, addParameter, getChildren, getDirectParametersMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ai.djl.nn.Block
forward, freezeParameters, freezeParameters, getOutputShapes
-
Constructor Details
-
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 Details