com.intel.analytics.bigdl.nn

TransformerCriterion

class TransformerCriterion[T] extends AbstractCriterion[Activity, Activity, T]

The criterion that takes two modules to transform input and target, and take one criterion to compute the loss with the transformed input and target.

This criterion can be used to construct complex criterion. For example, the inputTransformer and targetTransformer can be pre-trained CNN networks, and we can use the networks' output to calculate the high-level feature reconstruction loss, which is commonly used in areas like neural style transfer (https://arxiv.org/abs/1508.06576), texture synthesis (https://arxiv.org/abs/1505.07376), .etc.

T

The numeric type in the criterion, usually which are Float or Double

Linear Supertypes
AbstractCriterion[Activity, Activity, T], Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. TransformerCriterion
  2. AbstractCriterion
  3. Serializable
  4. Serializable
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TransformerCriterion(criterion: AbstractCriterion[Activity, Activity, T], inputTransformer: Option[AbstractModule[Activity, Activity, T]] = scala.None, targetTransformer: Option[AbstractModule[Activity, Activity, T]] = scala.None)(implicit arg0: ClassTag[T], ev: TensorNumeric[T])

    criterion
    inputTransformer
    targetTransformer

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def backward(input: Activity, target: Activity): Activity

    Performs a back-propagation step through the criterion, with respect to the given input.

    Performs a back-propagation step through the criterion, with respect to the given input.

    input

    input data

    target

    target

    returns

    gradient corresponding to input data

    Definition Classes
    AbstractCriterion
  8. def canEqual(other: Any): Boolean

    Definition Classes
    AbstractCriterion
  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def cloneCriterion(): AbstractCriterion[Activity, Activity, T]

    Deep copy this criterion

    Deep copy this criterion

    returns

    a deep copied criterion

    Definition Classes
    AbstractCriterion
  11. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. def forward(input: Activity, target: Activity): T

    Takes an input object, and computes the corresponding loss of the criterion, compared with target.

    Takes an input object, and computes the corresponding loss of the criterion, compared with target.

    input

    input data

    target

    target

    returns

    the loss of criterion

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

    Definition Classes
    AnyRef → Any
  16. var gradInput: Activity

    Definition Classes
    AbstractCriterion
  17. def hashCode(): Int

    Definition Classes
    AbstractCriterion → AnyRef → Any
  18. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  19. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  22. var output: T

    Definition Classes
    AbstractCriterion
  23. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  24. def toString(): String

    Definition Classes
    AnyRef → Any
  25. def updateGradInput(input: Activity, target: Activity): Activity

    Computing the gradient of the criterion with respect to its own input.

    Computing the gradient of the criterion with respect to its own input. This is returned in gradInput. Also, the gradInput state variable is updated accordingly.

    input

    input data

    target

    target data / labels

    returns

    gradient of input

    Definition Classes
    TransformerCriterionAbstractCriterion
  26. def updateOutput(input: Activity, target: Activity): T

    Computes the loss using input and objective function.

    Computes the loss using input and objective function. This function returns the result which is stored in the output field.

    input

    input of the criterion

    target

    target or labels

    returns

    the loss of the criterion

    Definition Classes
    TransformerCriterionAbstractCriterion
  27. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AbstractCriterion[Activity, Activity, T]

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped