Shortcuts

pypose.optim.kernel.Tolerant

class pypose.optim.kernel.Tolerant(a=1.0, b=-1.0)[source]

The robust Tolerant kernel cost function.

\[\bm{y}_i = b\log (1+e^{\frac{\bm{x}_i-a}{b}})-b\log (1+e^{\frac{-a}{b}}) \]

where \(\bm{a}\) and \(\bm{b}\) are hyperparameters, \(\bm{x}\) and \(\bm{y}\) are the input and output tensors, respectively.

Parameters
  • a (float) – Specify the Tolerant cost. The value must be positive. Default: 1.0

  • b (float) – Specify the Tolerant cost. The value must be negative. 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.Tolerant()
>>> input = torch.tensor([0, 0.5, 1, 2, 3])
>>> kernel(input)
tensor([0.0000, 0.4636, 0.7854, 1.1071, 1.2490])
../../_images/tolerant.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