princeton-vl / lietorch

BSD 3-Clause "New" or "Revised" License
663 stars 46 forks source link

matrix function have diffurent behaviors for random select #35

Open wanggaa opened 8 months ago

wanggaa commented 8 months ago

when use batch version matrix function,return answer is wrong

In [147]: rotvec = torch.randn(20,3)

In [148]: rots = SO3.InitFromVec(rotvec)

In [149]: rots.shape Out[149]: torch.Size([20])

In [150]: rots.vec()[-5] Out[150]: tensor([ 0.8872, -0.1591, -0.6459])

In [151]: rots[-5].vec() Out[151]: tensor([ 0.8872, -0.1591, -0.6459])

In [152]: rots.matrix()[-5] Out[152]: tensor([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]])

In [153]: rots[-5].matrix() Out[153]: tensor([[ 0.5612, 0.3888, -0.5711, 0.0000], [-0.7083, -0.2948, -0.6781, 0.0000], [-0.4283, -0.8729, -0.4626, 0.0000], [ 0.0000, 0.0000, 0.0000, 1.0000]])