Shortcuts

pypose.optim.kernel.Huber

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

The robust Huber kernel cost function.

\[\bm{y}_i = \begin{cases} \bm{x}_i & \text{if } \sqrt{\bm{x}_i} < \delta \\ 2 \delta \sqrt{\bm{x}_i} - \delta^2 & \text{otherwise } \end{cases}, \]

where \(\delta\) (delta) is a threshold, \(\bm{x}\) and \(\bm{y}\) are the input and output tensors, respectively.

Parameters

delta (float, optional) – Specify the threshold at which to scale the input. 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. Use torch.nn.HuberLoss instead, if a scalar Huber loss function is needed.

Example

>>> import pypose.optim.kernel as ppok
>>> kernel = ppok.Huber()
>>> input = torch.tensor([0, 0.5, 1, 2, 3])
>>> kernel(input)
tensor([0.0000, 0.5000, 1.0000, 1.8284, 2.4641])
../../_images/huber.png
forward(input)[source]
Parameters

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

Docs

Access documentation for PyPose

View Docs

Tutorials

Get started with tutorials and examples

View Tutorials

Get Started

Find resources and how to start using pypose

View Resources