Class

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

SimpleAttention

Related Doc: package attention

Permalink

abstract class SimpleAttention extends Attention[Output, core.Shape]

Base class for attention models that use as state the previous alignment.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SimpleAttention
  2. Attention
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SimpleAttention(memory: Output, memorySequenceLengths: Output = null, checkInnerDimensionsDefined: Boolean = true, scoreMaskValue: Output = Float.NegativeInfinity, name: String = "SimpleAttention")

    Permalink

Abstract Value Members

  1. abstract def score(query: Output, state: Output): Output

    Permalink

    Computes an alignment score for query.

    Computes an alignment score for query.

    query

    Query tensor.

    state

    Current attention mechanism state (defaults to the previous alignment tensor). The data type of this tensor matches that of values and its shape is [batchSize, alignmentSize], where alignmentSize is the memory's maximum time.

    returns

    Score tensor.

    Attributes
    protected
    Definition Classes
    Attention

Concrete 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 alignment(query: Output, previousState: Output): (Output, Output)

    Permalink

    Computes an alignment tensor given the provided query and previous alignment tensor.

    Computes an alignment tensor given the provided query and previous alignment tensor.

    The previous alignment tensor is important for attention mechanisms that use the previous alignment to calculate the attention at the next time step, such as monotonic attention mechanisms.

    TODO: Figure out how to generalize the "next state" functionality.

    query

    Query tensor.

    previousState

    Previous alignment tensor.

    returns

    Tuple containing the alignment tensor and the next attention state.

    Definition Classes
    SimpleAttentionAttention
  5. lazy val alignmentSize: Output

    Permalink
    Definition Classes
    Attention
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. lazy val batchSize: Output

    Permalink
    Definition Classes
    Attention
  8. val checkInnerDimensionsDefined: Boolean

    Permalink
    Definition Classes
    SimpleAttentionAttention
  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. lazy val dataType: types.DataType

    Permalink
    Definition Classes
    Attention
  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. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  16. lazy val initialAlignment: Output

    Permalink

    Initial alignment value.

    Initial alignment value.

    This is important for attention mechanisms that use the previous alignment to calculate the alignment at the next time step (e.g., monotonic attention).

    The default behavior is to return a tensor of all zeros.

    Definition Classes
    Attention
  17. def initialState: Output

    Permalink

    Initial state value.

    Initial state value.

    This is important for attention mechanisms that use the previous alignment to calculate the alignment at the next time step (e.g., monotonic attention).

    The default behavior is to return the same output as initialAlignment.

    Definition Classes
    SimpleAttentionAttention
  18. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  19. lazy val keys: Output

    Permalink
    Definition Classes
    Attention
  20. val memory: Output

    Permalink
    Attributes
    protected
    Definition Classes
    SimpleAttentionAttention
  21. val memorySequenceLengths: Output

    Permalink
    Attributes
    protected
    Definition Classes
    SimpleAttentionAttention
  22. val name: String

    Permalink
    Definition Classes
    SimpleAttentionAttention
  23. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  26. def probability(score: Output, state: Output): Output

    Permalink

    Computes alignment probabilities for score.

    Computes alignment probabilities for score.

    score

    Alignment score tensor.

    state

    Current attention mechanism state (defaults to the previous alignment tensor). The data type of this tensor matches that of values and its shape is [batchSize, alignmentSize], where alignmentSize is the memory's maximum time.

    returns

    Alignment probabilities tensor.

    Attributes
    protected
    Definition Classes
    Attention
  27. val scoreMaskValue: Output

    Permalink
    Definition Classes
    SimpleAttentionAttention
  28. def stateSize: core.Shape

    Permalink
    Definition Classes
    SimpleAttentionAttention
  29. final def synchronized[T0](arg0: ⇒ T0): T0

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

    Permalink
    Definition Classes
    AnyRef → Any
  31. lazy val values: Output

    Permalink
    Definition Classes
    Attention
  32. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Attention[Output, core.Shape]

Inherited from AnyRef

Inherited from Any

Ungrouped