Class/Object

org.platanios.tensorflow.api.ops.seq2seq.decoders

BeamSearchDecoder

Related Docs: object BeamSearchDecoder | package decoders

Permalink

class BeamSearchDecoder[S, SS] extends Decoder[Output, core.Shape, S, SS, decoders.BeamSearchDecoder.Output, (core.Shape, core.Shape, core.Shape), State[S, SS], (SS, core.Shape, core.Shape, core.Shape), FinalOutput, State[S, SS]]

Recurrent Neural Network (RNN) that uses beam search to find the highest scoring sequence (i.e., perform decoding).

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BeamSearchDecoder
  2. Decoder
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new BeamSearchDecoder(cell: RNNCell[Output, core.Shape, S, SS], initialCellState: S, embeddingFn: (Output) ⇒ Output, beginTokens: Output, endToken: Output, beamWidth: Int, lengthPenalty: LengthPenalty = NoPenalty, outputLayer: (Output) ⇒ Output = (o: Output) => o, reorderTensorArrays: Boolean = true, name: String = "BeamSearchRNNDecoder")(implicit evOutput: Aux[Output, core.Shape], evS: Aux[S, SS])

    Permalink

    cell

    RNN cell to use for decoding.

    initialCellState

    Initial RNN cell state to use for starting the decoding process.

    embeddingFn

    Function that takes an INT32 vector of IDs and returns the corresponding embedded values that will be passed to the decoder input.

    beginTokens

    INT32 vector with length equal to the batch size, which contains the begin-of-sequence token IDs.

    endToken

    INT32 scalar containing the end-of-sequence token ID (i.e., token ID which marks the end of decoding).

    beamWidth

    Beam width to use for the beam search while decoding.

    lengthPenalty

    Length penalty method.

    outputLayer

    Output layer to use that is applied at the outputs of the provided RNN cell before returning them.

    reorderTensorArrays

    If true, TensorArrays' elements within the cell state will be reordered according to the beam search path. If the TensorArray can be reordered, the stacked form will be returned. Otherwise, the TensorArray will be returned as is. Set this flag to false if the cell state contains any TensorArrays that are not amenable to reordering.

    name

    Name prefix used for all created ops.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. val batchSize: Output

    Permalink

    Scalar INT32 tensor representing the batch size of the input values.

    Scalar INT32 tensor representing the batch size of the input values.

    Definition Classes
    BeamSearchDecoderDecoder
  6. val beamWidth: Int

    Permalink

    Beam width to use for the beam search while decoding.

  7. val beginTokens: Output

    Permalink

    INT32 vector with length equal to the batch size, which contains the begin-of-sequence token IDs.

  8. val cell: RNNCell[Output, core.Shape, S, SS]

    Permalink

    RNN cell to use for decoding.

    RNN cell to use for decoding.

    Definition Classes
    BeamSearchDecoderDecoder
  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def decode(outputTimeMajor: Boolean = false, imputeFinished: Boolean = false, maximumIterations: Output = null, parallelIterations: Int = 32, swapMemory: Boolean = false, name: String = s"$name/DynamicRNNDecode"): (FinalOutput, State[S, SS], Output)

    Permalink

    Performs dynamic decoding using this decoder.

    Performs dynamic decoding using this decoder.

    This method calls initialize() once and next() repeatedly.

    Definition Classes
    Decoder
  11. val embeddingFn: (Output) ⇒ Output

    Permalink

    Function that takes an INT32 vector of IDs and returns the corresponding embedded values that will be passed to the decoder input.

  12. val endToken: Output

    Permalink

    INT32 scalar containing the end-of-sequence token ID (i.e., token ID which marks the end of decoding).

  13. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  15. def finalize(output: BeamSearchDecoder.Output, state: State[S, SS], sequenceLengths: Output): (FinalOutput, State[S, SS], Output)

    Permalink

    Finalizes the output of the decoding process.

    Finalizes the output of the decoding process.

    output

    Final output after decoding.

    state

    Final state after decoding.

    sequenceLengths

    Tensor containing the sequence lengths that the decoder cell outputs.

    returns

    Finalized output and state to return from the decoding process.

    Definition Classes
    BeamSearchDecoderDecoder
  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  18. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  19. val initialCellState: S

    Permalink

    Initial RNN cell state to use for starting the decoding process.

  20. def initialize(): (Output, Output, State[S, SS])

    Permalink

    This method is called before any decoding iterations.

    This method is called before any decoding iterations. It computes the initial input values and the initial state.

    returns

    Tuple containing: (i) a scalar BOOLEAN tensor specifying whether initialization has finished, (ii) the next input, and (iii) the initial decoder state.

    Definition Classes
    BeamSearchDecoderDecoder
  21. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  22. val lengthPenalty: LengthPenalty

    Permalink

    Length penalty method.

  23. val name: String

    Permalink

    Name prefix used for all created ops.

    Name prefix used for all created ops.

    Definition Classes
    BeamSearchDecoderDecoder
  24. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  25. def next(time: Output, input: Output, state: State[S, SS]): (BeamSearchDecoder.Output, State[S, SS], Output, Output)

    Permalink

    This method is called once per step of decoding (but only once for dynamic decoding).

    This method is called once per step of decoding (but only once for dynamic decoding).

    returns

    Tuple containing: (i) the decoder output for this step, (ii) the next decoder state, (iii) the next input, and (iv) a scalar BOOLEAN tensor specifying whether decoding has finished.

    Definition Classes
    BeamSearchDecoderDecoder
  26. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  27. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  28. val outputLayer: (Output) ⇒ Output

    Permalink

    Output layer to use that is applied at the outputs of the provided RNN cell before returning them.

  29. val reorderTensorArrays: Boolean

    Permalink

    If true, TensorArrays' elements within the cell state will be reordered according to the beam search path.

    If true, TensorArrays' elements within the cell state will be reordered according to the beam search path. If the TensorArray can be reordered, the stacked form will be returned. Otherwise, the TensorArray will be returned as is. Set this flag to false if the cell state contains any TensorArrays that are not amenable to reordering.

  30. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  31. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  32. val tracksOwnFinished: Boolean

    Permalink

    Describes whether the decoder keeps track of finished states.

    Describes whether the decoder keeps track of finished states.

    Most decoders will emit a true/false finished value independently at each time step. In this case, the dynamicDecode() function keeps track of which batch entries have already finished, and performs a logical OR to insert new batches to the finished set.

    Some decoders, however, shuffle batches/beams between time steps and dynamicDecode() will mix up the finished state across these entries because it does not track the reshuffling across time steps. In this case, it is up to the decoder to declare that it will keep track of its own finished state by setting this property to true.

    The beam-search decoder shuffles its beams and their finished state. For this reason, it conflicts with the dynamicDecode function's tracking of finished states. Setting this property to true avoids early stopping of decoding due to mismanagement of the finished state in dynamicDecode.

    Definition Classes
    BeamSearchDecoderDecoder
  33. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. def zeroOutput(): BeamSearchDecoder.Output

    Permalink
    Definition Classes
    BeamSearchDecoderDecoder

Inherited from AnyRef

Inherited from Any

Ungrouped