Shortcuts

pypose.testing.assert_close

class pypose.testing.assert_close(actual, expected, *args, **kwargs)[source]

Asserts that actual and expected are close. This function is exactly the same with torch.testing.assert_close except for that it also accepts pypose.LieTensor.

Parameters:
  • actual (Tensor or LieTensor) – Actual input.

  • expected (Tensor or LieTensor) – Expected input.

  • rtol (Optional[float]) – Relative tolerance. If specified atol must also be specified. If omitted, default values based on the dtype are selected with the below table.

  • atol (Optional[float]) – Absolute tolerance. If specified rtol must also be specified. If omitted, default values based on the dtype are selected with the below table.

If \(T_e\) and \(T_a\) are Lietensor, they are considered close if \(T_e*T_a^{-1} = \mathbf{O}\), where \(\mathbf{O}\) is close to zero tensor in the sense of torch.testing.assert_close is True.

Warning

The prerequisites for the other arguments align precisely with torch.testing.assert_close. Kindly consult it for further details.

Examples

>>> import pypose as pp
>>> actual = pp.randn_SE3(3)
>>> expected = actual.Log().Exp()
>>> pp.testing.assert_close(actual, expected, rtol=1e-5, atol=1e-5)

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