Skip to content

Conversation

@cdtwigg
Copy link
Contributor

@cdtwigg cdtwigg commented Jan 21, 2026

Summary:
Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:

  • Implemented array_mppca for converting MPPCA models to numpy arrays
  • Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
  • Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
  • Removed dependency on ATen/PyTorch tensor headers from geometry module
  • Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 21, 2026
@meta-codesync
Copy link
Contributor

meta-codesync bot commented Jan 21, 2026

@cdtwigg has exported this pull request. If you are a Meta employee, you can view the originating Diff in D89891113.

cdtwigg added a commit that referenced this pull request Jan 22, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
cdtwigg added a commit that referenced this pull request Jan 22, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
cdtwigg added a commit that referenced this pull request Jan 22, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
cdtwigg added a commit that referenced this pull request Jan 22, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
cdtwigg added a commit that referenced this pull request Jan 22, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
cdtwigg added a commit that referenced this pull request Jan 22, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
cdtwigg added a commit that referenced this pull request Jan 22, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
cdtwigg added a commit that referenced this pull request Jan 22, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
cdtwigg added a commit that referenced this pull request Jan 22, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
cdtwigg added a commit that referenced this pull request Jan 23, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
cdtwigg added a commit that referenced this pull request Jan 24, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
@cdtwigg cdtwigg force-pushed the export-D89891113 branch 2 times, most recently from 41310f1 to 6e35955 Compare January 24, 2026 06:16
cdtwigg added a commit that referenced this pull request Jan 24, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
cdtwigg added a commit that referenced this pull request Jan 24, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
cdtwigg added a commit that referenced this pull request Jan 24, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
cdtwigg added a commit that referenced this pull request Jan 24, 2026
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
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
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.

Differential Revision: D89891110
Summary:
Pull Request resolved: #967

Completed the migration from PyTorch tensors to numpy arrays for both MPPCA (Mixture of Probabilistic PCA) operations and kd-tree function bindings. This commit provides the Python bindings for both features.

Key changes:
- Implemented array_mppca for converting MPPCA models to numpy arrays
- Changed Mppca.to_tensors() to Mppca.to_arrays() returning numpy arrays instead of torch tensors
- Added Python bindings for find_closest_points, find_closest_points_with_normals, and find_closest_points_on_mesh using numpy arrays
- Removed dependency on ATen/PyTorch tensor headers from geometry module
- Updated test_posePrior to use numpy array indexing instead of tensor.select()

Note: This commit includes bindings for both the kd-tree functions (from the previous commit) and MPPCA, as they share common infrastructure changes (removing tensor includes and adding array includes).

Reviewed By: jeongseok-meta

Differential Revision: D89891113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants