Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

964 B
Raw Blame

fit_plane, fit_line, average_quaternions, solve_pnp_dlt, find_homography_dlt(solver="svd") and find_homography_lines_dlt return a finite gradient when the singular vector or eigenvector they keep is well defined but two of the other singular values or eigenvalues are equal. torch's SVD and eigh backward passes divide by the gap between every pair, so every entry of the gradient was NaN for some exact inputs, depending on the SVD backend: the corners of a square checkerboard (fit_plane), points along a coordinate axis (fit_line), identical members or rotations about one axis (average_quaternions), world points on the corners of a cube (solve_pnp_dlt) and the identity homography on an exact grid. The vector's value is unchanged; its gradient now divides only by the gaps to its own value, and equals the SVD's gradient to rounding wherever that is finite. Second derivatives use the same gaps, so they are finite at those inputs too.