test(index_reduce): align with Paddle compat index_reduce behavior#70
Open
youge325 wants to merge 1 commit into
Open
test(index_reduce): align with Paddle compat index_reduce behavior#70youge325 wants to merge 1 commit into
youge325 wants to merge 1 commit into
Conversation
Add cross-framework compatibility tests for Tensor::index_reduce: - 14 test cases covering prod/mean/amax/amin reduce modes - Shape coverage: small/large/boundary/1D/multi-dim - Dtype coverage: kFloat/kDouble/kInt/kLong - include_self true/false, in-place, non-member function - Invalid reduce type exception handling Related: PaddlePaddle/Paddle#79195 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new compat-layer regression test file IndexReduceTest.cpp that exercises Tensor::index_reduce / index_reduce_ / at::index_reduce to compare Torch vs Paddle output. The test follows the project's output-diff harness conventions (createFile on first test, openAppend afterwards, label + shape + first/last/sum serialization, dtype dispatch, exception marker for invalid reduce type).
Changes:
- New test file with 14 cases covering reduce modes (
prod,mean,amax,amin), dtypes (float,double,int,long), shapes (1D/2D/large/dim=1),include_self=false, in-place, non-member, and invalid-reduce exception. - Local helpers:
tensor_from_vector_i64for index tensors andwrite_index_reduce_result_to_filefor dtype-dispatched serialization. - Will be auto-picked up by the CMake glob to produce
torch_IndexReduceTestandpaddle_IndexReduceTest, then diffed byresult_cmp.sh.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Add cross-framework compatibility tests for
Tensor::index_reducein the Paddle C++ compat layer.Test Coverage (14 cases)
Related
🤖 Generated with Claude Code