When identity matrix is fed into so3_log_map() output is filled with nans:
~~~~
from pytorch3d.transforms.so3 import so3_log_map
import torch
R = torch.eye(3).unsqueeze(0)
ax_angle = so3_log_map(R)
print(ax_angle)
~~~~
It seems that when phi = 0 the phi.sign() outputs zero which further sets phi_valid to zero:https://github.com/facebookresearch/pytorch3d/blob/17ca6ecd81b49751fd4adcbd6effee9f3fbfc455/pytorch3d/transforms/so3.py#L155
Hi,
thanks a lot for pointing this out. We will very soon push a fix to this.
In case you need an urgent fix and can't wait for us to push it, you can replace
phi_valid = torch.clamp(phi.abs(), eps) * phi.sign()
with
phi_valid = torch.clamp(phi.abs(), eps) * phi.sign() + (phi == 0).type_as(phi) * eps
Most helpful comment
Hi,
thanks a lot for pointing this out. We will very soon push a fix to this.
In case you need an urgent fix and can't wait for us to push it, you can replace
phi_valid = torch.clamp(phi.abs(), eps) * phi.sign()with
phi_valid = torch.clamp(phi.abs(), eps) * phi.sign() + (phi == 0).type_as(phi) * eps