Class/Object

org.platanios.tensorflow.api.ops.rnn.attention

AttentionWrapperCell

Related Docs: object AttentionWrapperCell | package attention

Permalink

class AttentionWrapperCell[S, SS, AS, ASS] extends RNNCell[Output, core.Shape, AttentionWrapperState[S, SS, Seq[AS], Seq[ASS]], (SS, core.Shape, core.Shape, Seq[core.Shape], Seq[core.Shape], Seq[ASS])]

RNN cell that wraps another RNN cell and adds support for attention to it.

Linear Supertypes
RNNCell[Output, core.Shape, AttentionWrapperState[S, SS, Seq[AS], Seq[ASS]], (SS, core.Shape, core.Shape, Seq[core.Shape], Seq[core.Shape], Seq[ASS])], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AttentionWrapperCell
  2. RNNCell
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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. def apply(input: Tuple[Output, AttentionWrapperState[S, SS, Seq[AS], Seq[ASS]]]): Tuple[Output, AttentionWrapperState[S, SS, Seq[AS], Seq[ASS]]]

    Permalink
    Definition Classes
    RNNCell
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. val attentionLayerWeights: Seq[Output]

    Permalink

    Attention layer weights to use for projecting the computed attention.

  7. val attentions: Seq[Attention[AS, ASS]]

    Permalink

    Attention mechanisms to use.

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

    Permalink

    RNN cell being wrapped.

  9. val cellInputFn: (Output, Output) ⇒ Output

    Permalink

    Function that takes the original cell input tensor and the attention tensor as inputs and returns the mixed cell input to use.

    Function that takes the original cell input tensor and the attention tensor as inputs and returns the mixed cell input to use. Defaults to concatenating the two tensors across their last axis.

  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. def forward(input: Tuple[Output, AttentionWrapperState[S, SS, Seq[AS], Seq[ASS]]]): Tuple[Output, AttentionWrapperState[S, SS, Seq[AS], Seq[ASS]]]

    Permalink

    Performs a step using this attention-wrapped RNN cell.

    Performs a step using this attention-wrapped RNN cell.

    • Step 1: Mix the inputs and the previous step's attention output via cellInputFn.
    • Step 2: Call the wrapped cell with the mixed input and its previous state.
    • Step 3: Score the cell's output with attentionMechanism.
    • Step 4: Calculate the alignments by passing the score through the normalizer.
    • Step 5: Calculate the context vector as the inner product between the alignments and the attention mechanism's values (memory).
    • Step 6: Calculate the attention output by concatenating the cell output and context through the attention layer (a linear layer with attentionLayerWeights.shape(-1) outputs).
    input

    Input tuple to the attention wrapper cell.

    returns

    Next tuple.

    Definition Classes
    AttentionWrapperCellRNNCell
  15. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  17. def initialState(initialCellState: S, dataType: types.DataType = null): AttentionWrapperState[S, SS, Seq[AS], Seq[ASS]]

    Permalink

    Returns an initial state for this attention cell wrapper.

    Returns an initial state for this attention cell wrapper.

    initialCellState

    Initial state for the wrapped cell.

    dataType

    Optional data type which defaults to the data type of the last tensor in initialCellState.

    returns

    Initial state for this attention cell wrapper.

  18. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  19. val name: String

    Permalink

    Name prefix used for all new ops.

  20. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  21. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  23. val outputAttention: Boolean

    Permalink

    If true (the default), the output of this cell at each step is the attention value.

    If true (the default), the output of this cell at each step is the attention value. This is the behavior of Luong-style attention mechanisms. If false, the output at each step is the output of cell. This is the behavior of Bhadanau-style attention mechanisms. In both cases, the attention tensor is propagated to the next time step via the state and is used there. This flag only controls whether the attention mechanism is propagated up to the next cell in an RNN stack or to the top RNN output.

  24. def outputShape: core.Shape

    Permalink
    Definition Classes
    AttentionWrapperCellRNNCell
  25. def stateShape: (SS, core.Shape, core.Shape, Seq[core.Shape], Seq[core.Shape], Seq[ASS])

    Permalink
    Definition Classes
    AttentionWrapperCellRNNCell
  26. val storeAlignmentsHistory: Boolean

    Permalink

    If true, the alignments history from all steps is stored in the final output state (currently stored as a time major TensorArray on which you must call stack()).

    If true, the alignments history from all steps is stored in the final output state (currently stored as a time major TensorArray on which you must call stack()). Defaults to false.

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  29. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. def zeroState(batchSize: Output, dataType: types.DataType, shape: (SS, core.Shape, core.Shape, Seq[core.Shape], Seq[core.Shape], Seq[ASS]), name: String = "ZeroState"): AttentionWrapperState[S, SS, Seq[AS], Seq[ASS]]

    Permalink
    Definition Classes
    RNNCell

Inherited from RNNCell[Output, core.Shape, AttentionWrapperState[S, SS, Seq[AS], Seq[ASS]], (SS, core.Shape, core.Shape, Seq[core.Shape], Seq[core.Shape], Seq[ASS])]

Inherited from AnyRef

Inherited from Any

Ungrouped