-
Notifications
You must be signed in to change notification settings - Fork 549
Finalize Example-Level Shuffling (for non-GDT EBFs) Implementation and Update Test Cases 3/n #1671
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
Closed
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
|
@yeyingxiao has exported this pull request. If you are a Meta employee, you can view the originating Diff in D87590987. |
115de25 to
d149643
Compare
yeyingxiao
added a commit
to yeyingxiao/captum
that referenced
this pull request
Dec 17, 2025
…d Update Test Cases 3/n (meta-pytorch#1671) Summary: This diff completes the implementation of example-level shuffling for non-GDT format EBF and updates feature comparison and test utilities to support the new data structure. Key changes include: # Core Implementation - Finalize `group_events_by_example` and `flatten_events `in sigrid.py - These methods now fully support grouping and flattening features by example, handling lists of tensors as required. # Test Utilities - Update `find_perturbed_features` in `sigrid.py` - The function now supports comparison of both tensors and lists of tensors, ensuring correct detection of perturbed features regardless of feature structure. - Add `assertTupleOfListOfTensorsAlmostEqual` in `basic.py` - Enhanced to assert equality for tuples of lists of tensors, supporting the new output format from example-level shuffling. - Add `extracted_features_equal` in `basic.py` - Now recursively checks equality for tensors, lists of tensors, and tuples containing either, ensuring robust feature comparison. # Test Cases - Update Test Cases in test_feature_transform.py - When test_ebf_example_shuffling is enabled, uses assertTupleOfListOfTensorsAlmostEqual for feature comparison. - Otherwise, falls back to assertTensorTuplesAlmostEqual. - Update/Expand Test Cases in `feature_transform_tests.py` - Test cases for EBF example-level shuffling are updated to reflect the finalized grouping/flattening behavior. # Summary This diff ensures that the EBF example-level shuffling logic is fully implemented and that all relevant comparison and test utilities are compatible with the new extracted feature structure. All related test cases are updated to validate the new behavior, providing a robust foundation for future development and maintenance. Reviewed By: jjuncho Differential Revision: D87590987
yeyingxiao
added a commit
to yeyingxiao/captum
that referenced
this pull request
Dec 17, 2025
…d Update Test Cases 3/n (meta-pytorch#1671) Summary: This diff completes the implementation of example-level shuffling for non-GDT format EBF and updates feature comparison and test utilities to support the new data structure. Key changes include: # Core Implementation - Finalize `group_events_by_example` and `flatten_events `in sigrid.py - These methods now fully support grouping and flattening features by example, handling lists of tensors as required. # Test Utilities - Update `find_perturbed_features` in `sigrid.py` - The function now supports comparison of both tensors and lists of tensors, ensuring correct detection of perturbed features regardless of feature structure. - Add `assertTupleOfListOfTensorsAlmostEqual` in `basic.py` - Enhanced to assert equality for tuples of lists of tensors, supporting the new output format from example-level shuffling. - Add `extracted_features_equal` in `basic.py` - Now recursively checks equality for tensors, lists of tensors, and tuples containing either, ensuring robust feature comparison. # Test Cases - Update Test Cases in test_feature_transform.py - When test_ebf_example_shuffling is enabled, uses assertTupleOfListOfTensorsAlmostEqual for feature comparison. - Otherwise, falls back to assertTensorTuplesAlmostEqual. - Update/Expand Test Cases in `feature_transform_tests.py` - Test cases for EBF example-level shuffling are updated to reflect the finalized grouping/flattening behavior. # Summary This diff ensures that the EBF example-level shuffling logic is fully implemented and that all relevant comparison and test utilities are compatible with the new extracted feature structure. All related test cases are updated to validate the new behavior, providing a robust foundation for future development and maintenance. Reviewed By: jjuncho Differential Revision: D87590987
d149643 to
465f458
Compare
…d Update Test Cases 3/n (meta-pytorch#1671) Summary: This diff completes the implementation of example-level shuffling for non-GDT format EBF and updates feature comparison and test utilities to support the new data structure. Key changes include: # Core Implementation - Finalize `group_events_by_example` and `flatten_events `in sigrid.py - These methods now fully support grouping and flattening features by example, handling lists of tensors as required. # Test Utilities - Update `find_perturbed_features` in `sigrid.py` - The function now supports comparison of both tensors and lists of tensors, ensuring correct detection of perturbed features regardless of feature structure. - Add `assertTupleOfListOfTensorsAlmostEqual` in `basic.py` - Enhanced to assert equality for tuples of lists of tensors, supporting the new output format from example-level shuffling. - Add `extracted_features_equal` in `basic.py` - Now recursively checks equality for tensors, lists of tensors, and tuples containing either, ensuring robust feature comparison. # Test Cases - Update Test Cases in test_feature_transform.py - When test_ebf_example_shuffling is enabled, uses assertTupleOfListOfTensorsAlmostEqual for feature comparison. - Otherwise, falls back to assertTensorTuplesAlmostEqual. - Update/Expand Test Cases in `feature_transform_tests.py` - Test cases for EBF example-level shuffling are updated to reflect the finalized grouping/flattening behavior. # Summary This diff ensures that the EBF example-level shuffling logic is fully implemented and that all relevant comparison and test utilities are compatible with the new extracted feature structure. All related test cases are updated to validate the new behavior, providing a robust foundation for future development and maintenance. Reviewed By: jjuncho Differential Revision: D87590987
465f458 to
8c4a9bf
Compare
Contributor
|
This pull request has been merged in 0e75981. |
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.
Summary:
This diff completes the implementation of example-level shuffling for non-GDT format EBF and updates feature comparison and test utilities to support the new data structure. Key changes include:
Core Implementation
group_events_by_exampleandflatten_eventsin sigrid.pyTest Utilities
find_perturbed_featuresinsigrid.pyassertTupleOfListOfTensorsAlmostEqualinbasic.pyextracted_features_equalinbasic.pyTest Cases
Update Test Cases in test_feature_transform.py
Update/Expand Test Cases in
feature_transform_tests.pySummary
This diff ensures that the EBF example-level shuffling logic is fully implemented and that all relevant comparison and test utilities are compatible with the new extracted feature structure. All related test cases are updated to validate the new behavior, providing a robust foundation for future development and maintenance.
Differential Revision: D87590987