Class 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

        block
      • Fields inherited from class ai.djl.nn.AbstractBlock

        children, parameters
      • Fields inherited from class ai.djl.nn.AbstractBaseBlock

        inputNames, inputShapes, outputDataTypes, version
    • 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 of SimpleTextDecoder with the given RecurrentBlock.
      SimpleTextDecoder​(ai.djl.nn.recurrent.RecurrentBlock recurrentBlock, int vocabSize)
      Contructs a new instance of SimpleTextDecoder with the given RecurrentBlock.
    • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface ai.djl.nn.Block

        forward, freezeParameters, getOutputShapes
    • Constructor Detail

      • SimpleTextDecoder

        public SimpleTextDecoder​(ai.djl.nn.recurrent.RecurrentBlock recurrentBlock,
                                 int vocabSize)
        Contructs a new instance of SimpleTextDecoder with the given RecurrentBlock. 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 decode
        vocabSize - the size of the Vocabulary
      • SimpleTextDecoder

        public SimpleTextDecoder​(ai.djl.modality.nlp.embedding.TrainableTextEmbedding trainableTextEmbedding,
                                 ai.djl.nn.recurrent.RecurrentBlock recurrentBlock,
                                 long vocabSize)
        Contructs a new instance of SimpleTextDecoder with the given RecurrentBlock. Use this constructor if you are planning to use pre-trained embeddings that don't need further training.
        Parameters:
        trainableTextEmbedding - the TrainableTextEmbedding to train embeddings with
        recurrentBlock - the recurrent block to be used to decode
        vocabSize - the size of the Vocabulary
    • 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 class ai.djl.modality.nlp.Decoder