-
Notifications
You must be signed in to change notification settings - Fork 32
Add missing consistency tests for geometry/diff_geometry #977
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
7
commits into
main
Choose a base branch
from
export-D89915090
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
Summary: Pull Request resolved: #977 Adds 4 new consistency tests to verify that pymomentum.geometry functions (using numpy arrays/py::buffers) match their pymomentum.diff_geometry counterparts (using torch tensors): - test_apply_inverse_parameter_transform_matches: Tests inverse parameter transform - test_model_parameters_to_blend_shape_coefficients_matches: Tests blend shape coeff extraction - test_model_parameters_to_face_expression_coefficients_matches: Tests face expression coeff extraction - test_map_model_parameters_with_names_matches: Tests parameter mapping with names These tests complete the coverage for the torch.Tensor to py::buffer conversion, bringing total consistency tests from 21 to 25 (100% coverage of converted functions). Reviewed By: jeongseok-meta Differential Revision: D89915090
449df0b to
433dd29
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 22, 2026
Summary: Pull Request resolved: #977 Adds 4 new consistency tests to verify that pymomentum.geometry functions (using numpy arrays/py::buffers) match their pymomentum.diff_geometry counterparts (using torch tensors): - test_apply_inverse_parameter_transform_matches: Tests inverse parameter transform - test_model_parameters_to_blend_shape_coefficients_matches: Tests blend shape coeff extraction - test_model_parameters_to_face_expression_coefficients_matches: Tests face expression coeff extraction - test_map_model_parameters_with_names_matches: Tests parameter mapping with names These tests complete the coverage for the torch.Tensor to py::buffer conversion, bringing total consistency tests from 21 to 25 (100% coverage of converted functions). Reviewed By: jeongseok-meta Differential Revision: D89915090
433dd29 to
c67d357
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 22, 2026
Summary: Pull Request resolved: #977 Adds 4 new consistency tests to verify that pymomentum.geometry functions (using numpy arrays/py::buffers) match their pymomentum.diff_geometry counterparts (using torch tensors): - test_apply_inverse_parameter_transform_matches: Tests inverse parameter transform - test_model_parameters_to_blend_shape_coefficients_matches: Tests blend shape coeff extraction - test_model_parameters_to_face_expression_coefficients_matches: Tests face expression coeff extraction - test_map_model_parameters_with_names_matches: Tests parameter mapping with names These tests complete the coverage for the torch.Tensor to py::buffer conversion, bringing total consistency tests from 21 to 25 (100% coverage of converted functions). Reviewed By: jeongseok-meta Differential Revision: D89915090
c67d357 to
ab1182b
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 22, 2026
Summary: Pull Request resolved: #977 Adds 4 new consistency tests to verify that pymomentum.geometry functions (using numpy arrays/py::buffers) match their pymomentum.diff_geometry counterparts (using torch tensors): - test_apply_inverse_parameter_transform_matches: Tests inverse parameter transform - test_model_parameters_to_blend_shape_coefficients_matches: Tests blend shape coeff extraction - test_model_parameters_to_face_expression_coefficients_matches: Tests face expression coeff extraction - test_map_model_parameters_with_names_matches: Tests parameter mapping with names These tests complete the coverage for the torch.Tensor to py::buffer conversion, bringing total consistency tests from 21 to 25 (100% coverage of converted functions). Reviewed By: jeongseok-meta Differential Revision: D89915090
ab1182b to
4489267
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 22, 2026
Summary: Pull Request resolved: #977 Adds 4 new consistency tests to verify that pymomentum.geometry functions (using numpy arrays/py::buffers) match their pymomentum.diff_geometry counterparts (using torch tensors): - test_apply_inverse_parameter_transform_matches: Tests inverse parameter transform - test_model_parameters_to_blend_shape_coefficients_matches: Tests blend shape coeff extraction - test_model_parameters_to_face_expression_coefficients_matches: Tests face expression coeff extraction - test_map_model_parameters_with_names_matches: Tests parameter mapping with names These tests complete the coverage for the torch.Tensor to py::buffer conversion, bringing total consistency tests from 21 to 25 (100% coverage of converted functions). Reviewed By: jeongseok-meta Differential Revision: D89915090
4489267 to
1098775
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 22, 2026
Summary: Pull Request resolved: #977 Adds 4 new consistency tests to verify that pymomentum.geometry functions (using numpy arrays/py::buffers) match their pymomentum.diff_geometry counterparts (using torch tensors): - test_apply_inverse_parameter_transform_matches: Tests inverse parameter transform - test_model_parameters_to_blend_shape_coefficients_matches: Tests blend shape coeff extraction - test_model_parameters_to_face_expression_coefficients_matches: Tests face expression coeff extraction - test_map_model_parameters_with_names_matches: Tests parameter mapping with names These tests complete the coverage for the torch.Tensor to py::buffer conversion, bringing total consistency tests from 21 to 25 (100% coverage of converted functions). Reviewed By: jeongseok-meta Differential Revision: D89915090
1098775 to
a5ded1e
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 22, 2026
Summary: Pull Request resolved: #977 Adds 4 new consistency tests to verify that pymomentum.geometry functions (using numpy arrays/py::buffers) match their pymomentum.diff_geometry counterparts (using torch tensors): - test_apply_inverse_parameter_transform_matches: Tests inverse parameter transform - test_model_parameters_to_blend_shape_coefficients_matches: Tests blend shape coeff extraction - test_model_parameters_to_face_expression_coefficients_matches: Tests face expression coeff extraction - test_map_model_parameters_with_names_matches: Tests parameter mapping with names These tests complete the coverage for the torch.Tensor to py::buffer conversion, bringing total consistency tests from 21 to 25 (100% coverage of converted functions). Reviewed By: jeongseok-meta Differential Revision: D89915090
a5ded1e to
f1b2970
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 22, 2026
Summary: Pull Request resolved: #977 Adds 4 new consistency tests to verify that pymomentum.geometry functions (using numpy arrays/py::buffers) match their pymomentum.diff_geometry counterparts (using torch tensors): - test_apply_inverse_parameter_transform_matches: Tests inverse parameter transform - test_model_parameters_to_blend_shape_coefficients_matches: Tests blend shape coeff extraction - test_model_parameters_to_face_expression_coefficients_matches: Tests face expression coeff extraction - test_map_model_parameters_with_names_matches: Tests parameter mapping with names These tests complete the coverage for the torch.Tensor to py::buffer conversion, bringing total consistency tests from 21 to 25 (100% coverage of converted functions). Reviewed By: jeongseok-meta Differential Revision: D89915090
f1b2970 to
e7deda5
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 23, 2026
Summary: Pull Request resolved: #977 Adds 4 new consistency tests to verify that pymomentum.geometry functions (using numpy arrays/py::buffers) match their pymomentum.diff_geometry counterparts (using torch tensors): - test_apply_inverse_parameter_transform_matches: Tests inverse parameter transform - test_model_parameters_to_blend_shape_coefficients_matches: Tests blend shape coeff extraction - test_model_parameters_to_face_expression_coefficients_matches: Tests face expression coeff extraction - test_map_model_parameters_with_names_matches: Tests parameter mapping with names These tests complete the coverage for the torch.Tensor to py::buffer conversion, bringing total consistency tests from 21 to 25 (100% coverage of converted functions). Reviewed By: jeongseok-meta Differential Revision: D89915090
e7deda5 to
ee92105
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 24, 2026
Summary: Pull Request resolved: #977 Adds 4 new consistency tests to verify that pymomentum.geometry functions (using numpy arrays/py::buffers) match their pymomentum.diff_geometry counterparts (using torch tensors): - test_apply_inverse_parameter_transform_matches: Tests inverse parameter transform - test_model_parameters_to_blend_shape_coefficients_matches: Tests blend shape coeff extraction - test_model_parameters_to_face_expression_coefficients_matches: Tests face expression coeff extraction - test_map_model_parameters_with_names_matches: Tests parameter mapping with names These tests complete the coverage for the torch.Tensor to py::buffer conversion, bringing total consistency tests from 21 to 25 (100% coverage of converted functions). Reviewed By: jeongseok-meta Differential Revision: D89915090
ee92105 to
c695db6
Compare
cdtwigg
added a commit
that referenced
this pull request
Jan 28, 2026
Summary: Pull Request resolved: #977 Adds 4 new consistency tests to verify that pymomentum.geometry functions (using numpy arrays/py::buffers) match their pymomentum.diff_geometry counterparts (using torch tensors): - test_apply_inverse_parameter_transform_matches: Tests inverse parameter transform - test_model_parameters_to_blend_shape_coefficients_matches: Tests blend shape coeff extraction - test_model_parameters_to_face_expression_coefficients_matches: Tests face expression coeff extraction - test_map_model_parameters_with_names_matches: Tests parameter mapping with names These tests complete the coverage for the torch.Tensor to py::buffer conversion, bringing total consistency tests from 21 to 25 (100% coverage of converted functions). Reviewed By: jeongseok-meta Differential Revision: D89915090
c695db6 to
0c61ae6
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
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: 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). Differential Revision: D89891113
Summary: Removes all torch/aten dependencies from the pymomentum.geometry module now that all geometry operations have been migrated to numpy arrays. This includes: - Removing torch header includes from C++ source files - Removing torch import from the Python module initialization - Removing torch from BUCK python_typing_deps - Removing PYMOMENTUM_LIMITED_TORCH_API guards (no longer needed) - Regenerating geometry.pyi to reflect numpy-based API (to_arrays instead of to_tensors) The geometry module now operates entirely on numpy arrays via the Buffer protocol. The diff_geometry module retains its torch dependency for differentiable operations. Differential Revision: D89893026
Summary: Pull Request resolved: #977 Adds 4 new consistency tests to verify that pymomentum.geometry functions (using numpy arrays/py::buffers) match their pymomentum.diff_geometry counterparts (using torch tensors): - test_apply_inverse_parameter_transform_matches: Tests inverse parameter transform - test_model_parameters_to_blend_shape_coefficients_matches: Tests blend shape coeff extraction - test_model_parameters_to_face_expression_coefficients_matches: Tests face expression coeff extraction - test_map_model_parameters_with_names_matches: Tests parameter mapping with names These tests complete the coverage for the torch.Tensor to py::buffer conversion, bringing total consistency tests from 21 to 25 (100% coverage of converted functions). Reviewed By: jeongseok-meta Differential Revision: D89915090
0c61ae6 to
d07e3a3
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:
Adds 4 new consistency tests to verify that pymomentum.geometry functions
(using numpy arrays/py::buffers) match their pymomentum.diff_geometry counterparts
(using torch tensors):
These tests complete the coverage for the torch.Tensor to py::buffer conversion,
bringing total consistency tests from 21 to 25 (100% coverage of converted functions).
Reviewed By: jeongseok-meta
Differential Revision: D89915090