# pypose.optim.kernel.PseudoHuber¶

class pypose.optim.kernel.PseudoHuber(delta=1.0)[source]

The robust pseudo Huber kernel cost function.

$\bm{y}_i = 2\delta^2 \left(\sqrt{1 + \bm{x}_i/\delta^2} - 1\right),$

where $$\delta$$ (delta) defines the steepness of the slope, $$\bm{x}$$ and $$\bm{y}$$ are the input and output tensors, respectively. It can be used as a smooth version of Huber.

Parameters

delta (float, optional) – Specify the slope. The value must be positive. Default: 1.0

Note

The input has to be a non-negative tensor and the output tensor has the same shape with the input.

Example

>>> import pypose.optim.kernel as ppok
>>> kernel = ppok.PseudoHuber()
>>> input = torch.tensor([0, 0.5, 1, 2, 3])
>>> kernel(input)
tensor([0.0000, 0.4495, 0.8284, 1.4641, 2.0000])

forward(input)[source]
Parameters

input (torch.Tensor) – the input tensor (non-negative).