Repository navigation
Preserve least-squares optimum in svdtf reflection correction - #437
Merged
wang-chen merged 1 commit intoOct 20, 2026
Merged
Conversation
Correct only the weakest singular direction when the SVD rotation is improper, and cover reflected, planar and batched rigid alignments. Fixes pypose#436. Signed-off-by: Afloat <[email protected]>
Member
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
wang-chen
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #436.
svdtfcurrently negates the entire unconstrained rotation when its determinant is negative. That produces a proper rotation, but does not preserve the least-squares optimum. For the six-point example in the issue, it returns SSE 112 instead of the attainable minimum 8. Exact planar rigid alignments can also be affected by the sign chosen for the null singular direction.Apply the determinant correction only to the weakest singular direction. The correction is allocated from the singular values, preserving device and dtype; the SVD factors are not modified in place. The public SE(3) return type, translation formula, and separate
svdstfimplementation are unchanged.Add regression coverage for reflections along each axis, exact planar and full-rank rigid transforms, translated/rotated coordinate frames, mixed and multidimensional broadcast batches, float32/float64, and float64 raw-output autograd checks for both determinant signs.
Validation on Linux, Python 3.12.14, PyTorch 2.7.1+cpu, torchvision 0.22.1+cpu, and NumPy 2.3.5:
The raw returned
.tensor()passes finite-difference gradchecks for both determinant signs. Separate downstream.matrix()gradchecks have an inherited discrepancy on both the baseline and this change; this PR does not change LieTensor gradient conventions or claim to fix that behavior. GPU execution, end-to-end ICP/EPnP quality and performance were not validated. Existing CPU ICP/EPnP tests do pass as part of the complete suite.