SquaredHingeLoss

class SquaredHingeLoss @JvmOverloads constructor(margin: Float = 1.0f) : Loss(source)

Squared Hinge Loss.

SquaredHinge(pred, target) = max(0, margin - target * pred)^2

This is a squared version of hinge loss, which can be easier to optimize due to being differentiable everywhere.

Parameters

margin

The margin parameter. Default is 1.0.

Constructors

Link copied to clipboard
constructor(margin: Float = 1.0f)

Functions

Link copied to clipboard
open override fun <T : DType, V> forward(preds: Tensor<T, V>, targets: Tensor<out DType, *>, ctx: ExecutionContext, reduction: Reduction): Tensor<T, V>