pypose.testing.assert_close¶
- class pypose.testing.assert_close(actual, expected, *args, **kwargs)[source]¶
Asserts that
actual
andexpected
are close. This function is exactly the same with torch.testing.assert_close except for that it also acceptspypose.LieTensor
.- Parameters:
actual (
Tensor
orLieTensor
) – Actual input.expected (
Tensor
orLieTensor
) – Expected input.rtol (Optional[float]) – Relative tolerance. If specified
atol
must also be specified. If omitted, default values based on thedtype
are selected with the below table.atol (Optional[float]) – Absolute tolerance. If specified
rtol
must also be specified. If omitted, default values based on thedtype
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
isTrue.
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)