Skip to content

Commit

Permalink
Changed w_sqrt to handle 0 weights for nondiff and diff
Browse files Browse the repository at this point in the history
  • Loading branch information
lisusdaniil committed Jan 26, 2024
1 parent dc4ccab commit 59a8a07
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions dICP/ICP.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,7 @@ def dICP(self, source, target, T_init, weight=None, trim_dist=None, loss_fn=None
# Compute weighted Jacobian and error, this avoids having to form a weight matrix
# which can be memory expensive
# We add and subtract 1e-5 to avoid sqrt(0) nan gradients
if self.diff:
w_sqrt = torch.sqrt(w + 1.0e-10) - 1.0e-5
else:
w_sqrt = torch.sqrt(w)
w_sqrt = torch.sqrt(w)
err_w = w_sqrt.unsqueeze(-1) * err
J_w = w_sqrt.unsqueeze(-1) * J

Expand Down

0 comments on commit 59a8a07

Please sign in to comment.