Shortcuts

pypose.pm

class pypose.pm(input)[source]

Returns plus or minus (\(\pm\)) states for tensor.

Parameters:

input (Tensor) – the input tensor.

Returns:

the output tensor contains only \(-1\) or \(+1\).

Return type:

Tensor

Note

The pm() function is different from torch.sign(), which returns \(0\) for zero inputs, it will return \(+1\) if an input element is zero.

Example

>>> pp.pm(torch.tensor([0.1, 0, -0.2]))
tensor([ 1.,  1., -1.])
>>> pp.pm(torch.tensor([0.1, 0, -0.2], dtype=torch.float64))
tensor([ 1.,  1., -1.], dtype=torch.float64)

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