You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During the development of the skew2vec function (trying to transform the skew-symmetric matrix to the 3D vector), I found when using this formula err_pose = (torch.mm(desired_pose.T, Rwb) - torch.mm(Rwb.T, desired_pose))(All tensor is 3x3 matrix) which is similar with torch.mm(A, B.T) - torch.mm(B, A.T), the result will not match the skew-symmetric characteristic and the difference is pretty small.
The implementation of skew2vec function is:
def skew2vec(input:torch.Tensor) -> torch.Tensor:
v = input.tensor() if hasattr(input, 'ltype') else input
assert v.shape[-2:] == (3, 3), "Last 2 dim should be (3, 3)"
assert torch.equal(v.permute(0, 2, 1), -v), "Each matrix must be a skew matrix"
return torch.stack([torch.stack([-v[..., 1, 2]], dim=-1),
torch.stack([ v[..., 0, 2]], dim=-1),
torch.stack([-v[..., 0, 1]], dim=-1)], dim=-1)
The following is the tensor calculation result when I use cuda type tensor.
🐛 Describe the bug
During the development of the
skew2vec
function (trying to transform the skew-symmetric matrix to the 3D vector), I found when using this formulaerr_pose = (torch.mm(desired_pose.T, Rwb) - torch.mm(Rwb.T, desired_pose))
(All tensor is 3x3 matrix) which is similar withtorch.mm(A, B.T) - torch.mm(B, A.T)
, the result will not match the skew-symmetric characteristic and the difference is pretty small.The implementation of
skew2vec
function is:The following is the tensor calculation result when I use
cuda
type tensor.which will cause the second assertion in the
skew2vec
function being failed. The PyTorch official is aware of thisNUMERICAL ACCURACY
problem.I also found some functions have added the
rtol
andatol
parameters in the method, e.g. thismat2SO3
functionpypose/pypose/lietensor/convert.py
Line 258 in 3b31492
Maybe the best way to also add the
rtol
andatol
in theskew2vec
parameters and usetorch.allclose
to check the equality?Versions
The text was updated successfully, but these errors were encountered: