com.intel.analytics.bigdl.nn

SoftmaxWithCriterion

class SoftmaxWithCriterion[T] extends TensorCriterion[T]

Computes the multinomial logistic loss for a one-of-many classification task, passing real-valued predictions through a softmax to get a probability distribution over classes. It should be preferred over separate SoftmaxLayer + MultinomialLogisticLossLayer as its gradient computation is more numerically stable.

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

Instance Constructors

  1. new SoftmaxWithCriterion(ignoreLabel: Option[Int] = scala.None, normalizeMode: NormMode = NormMode.VALID)(implicit arg0: ClassTag[T], ev: TensorNumeric[T])

    ignoreLabel

    (optional) Specify a label value that should be ignored when computing the loss.

    normalizeMode

    How to normalize the output loss.

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: Tensor[T], target: Tensor[T]): Tensor[T]

    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[Tensor[T], Tensor[T], 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: Tensor[T], target: Tensor[T]): 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. def getNormalizer(normalizeMode: NormMode, validCount: Int): T

    Read the normalization mode parameter and compute the normalizer based on the input size.

    Read the normalization mode parameter and compute the normalizer based on the input size. If normalizeMode is VALID, the count of valid outputs will be read from validCount, unless it is -1 in which case all outputs are assumed to be valid.

  17. var gradInput: Tensor[T]

    Definition Classes
    AbstractCriterion
  18. def hashCode(): Int

    Definition Classes
    AbstractCriterion → AnyRef → Any
  19. var innerNum: Int

  20. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  21. var nClasses: Int

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

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

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

    Definition Classes
    AnyRef
  25. var outerNum: Int

  26. var output: T

    Definition Classes
    AbstractCriterion
  27. var prob: Tensor[T]

  28. var softmax: SoftMax[T]

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

    Definition Classes
    AnyRef
  30. def toString(): String

    Definition Classes
    AnyRef → Any
  31. def updateGradInput(input: Tensor[T], target: Tensor[T]): Tensor[T]

    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
    SoftmaxWithCriterionAbstractCriterion
  32. def updateOutput(input: Tensor[T], target: Tensor[T]): T

    compute the loss

    compute the loss

    input

    input.size(1) is batch num input.size(2) is the softmaxAxis, number of classes as usual

    target

    target or labels

    returns

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from TensorCriterion[T]

Inherited from AbstractCriterion[Tensor[T], Tensor[T], T]

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped