mxnet.npx.smooth_l1¶
-
smooth_l1
(data=None, scalar=_Null, out=None, name=None, **kwargs)¶ 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]
Defined in /work/mxnet/src/operator/tensor/elemwise_binary_scalar_op_extended.cc:L137
- Parameters
data (ndarray) – source input
scalar (float) – scalar input
out (ndarray, optional) – The output ndarray to hold the result.
- Returns
out – The output of this function.
- Return type
ndarray or list of ndarrays
Did this page help you?
Yes
No
Thanks for your feedback!