-
Notifications
You must be signed in to change notification settings - Fork 32
Migrate kd-tree operations to numpy arrays with RowMajor storage fix #970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cdtwigg
wants to merge
4
commits into
main
Choose a base branch
from
export-D89891110
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Contributor
cdtwigg
added a commit
that referenced
this pull request
Jan 22, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
7ab2e59 to
208bf03
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 22, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
b637005 to
003423a
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 22, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
cdtwigg
added a commit
that referenced
this pull request
Jan 22, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
003423a to
2e52609
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 22, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
2e52609 to
e43e716
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 22, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
e43e716 to
f701fdf
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 22, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
f701fdf to
e473bac
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 23, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
e473bac to
1b130f4
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 24, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
1b130f4 to
e0c38cd
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 24, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
e0c38cd to
ecd1940
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 24, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
ecd1940 to
bc33f08
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 24, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
bc33f08 to
9bada54
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 24, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
9bada54 to
695d1de
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 28, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
695d1de to
890cd01
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 28, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
890cd01 to
e9aeb85
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 28, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
e9aeb85 to
3f500dd
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 28, 2026
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
3f500dd to
d8ab83c
Compare
Summary: Completed migration of parameter transform functions in the geometry module from torch.Tensor to numpy arrays. This maintains consistency with the geometry module's design principle of using numpy for fast forward operations while keeping torch tensors in diff_geometry for differentiable operations. Key changes: - Implemented arrayToParameterSet() to convert boolean numpy arrays to ParameterSet - Updated all parameter property bindings (scaling_parameters, rigid_parameters, etc.) to return numpy arrays - Converted simplify(), simplify_parameter_transform(), parameters_for_joints(), and joints_for_parameters() to use arrays - Updated reduce_to_selected_model_parameters() to use array-based parameter sets - Updated tests to work with numpy arrays instead of tensors - Updated .pyi type stubs to reflect numpy array usage Differential Revision: D89891109
Summary: Implemented numpy array version of apply_model_param_limits() for the geometry module. This function clamps model parameters to their specified min/max bounds using the character's parameter limits. The implementation uses ModelParametersAccessor for clean data access and supports arbitrary batch dimensions with parallel processing. It only applies MinMax type parameter limits. Key changes: - Added applyModelParameterLimits() in momentum_geometry.cpp/h - Uses ArrayChecker pattern for input validation - Supports both float32 and float64 dtypes - Parallel batch processing with dispenso - Bound as Character.apply_model_param_limits() - Added tests in test_geometry.py - Added consistency test in test_geometry_diff_geometry_consistency.py - Updated .pyi type stubs Differential Revision: D89891111
Summary: Converted Character.skin_skinned_locators() from torch.Tensor to numpy arrays to maintain consistency with the geometry module. This function applies linear blend skinning to compute world-space positions of skinned locators. The implementation follows the core skinning algorithm from momentum's skinned_locator_error_function: for each locator, transform the rest position using inverse bind pose and joint transforms weighted by bone influences. Key changes: - Added skinSkinnedLocatorsArray() in array_skinning.cpp/h - Uses SkeletonStateAccessor and VectorArrayAccessor for clean data access - Supports arbitrary batch dimensions with parallel processing - Handles optional rest positions (uses locator positions if not provided) - Returns empty [0, 3] array if character has no skinned locators - Updated Character.skin_skinned_locators() binding to use array version - Updated .pyi type stubs Differential Revision: D89891114
…970) Summary: Pull Request resolved: #970 Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy. The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen. Reviewed By: jeongseok-meta Differential Revision: D89891110
d8ab83c to
635d139
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Summary:
Migrated find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh from torch tensors to numpy arrays. This continues the broader migration of pymomentum geometry operations from PyTorch to numpy.
The key technical challenge was ensuring correct memory layout for the SimdKdTree library. Eigen matrices use column-major storage by default, but SimdKdTree expects row-major data where each point's coordinates are contiguous. Added a conditional toMatrix() method to VectorArrayAccessor that uses RowMajor storage for multi-dimensional points (Dim > 1) while preserving ColMajor for column vectors (Dim == 1) as required by Eigen.
Reviewed By: jeongseok-meta
Differential Revision: D89891110