mx.symbol.smooth_l1

Description

Calculate Smooth L1 Loss(lhs, scalar) by summing.

\[\begin{split} f(x) = \begin{cases} (\sigma x)^2/2,& \text{if }x < 1/\sigma^2\\ |x|-0.5/\sigma^2,& \text{otherwise} \end{cases}\end{split}\]

where \(x\) is an element of the tensor lhs and \(\sigma\) is the scalar.

Example:

smooth_l1([1, 2, 3, 4]) = [0.5, 1.5, 2.5, 3.5]
smooth_l1([1, 2, 3, 4], scalar=1) = [0.5, 1.5, 2.5, 3.5]

Usage

mx.symbol.smooth_l1(...)

Arguments

Argument

Description

data

NDArray-or-Symbol source input

scalar

float.

scalar input

name

string, optional.

Name of the resulting symbol.