[Relax][TFLite] Add gather frontend expected IRModule tests#19516
Open
weicheng-hsu wants to merge 1 commit intoapache:mainfrom
Open
[Relax][TFLite] Add gather frontend expected IRModule tests#19516weicheng-hsu wants to merge 1 commit intoapache:mainfrom
weicheng-hsu wants to merge 1 commit intoapache:mainfrom
Conversation
This adds explicit Expected IRModule coverage for TFLite GATHER and GATHER_ND frontend conversion. GATHER_ND uses Relax gather_nd with int64 indices, so the frontend now casts int32 TFLite indices to int64 before emitting the Relax op. This keeps the generated module well-typed and matches the expected Relax IR.
Contributor
There was a problem hiding this comment.
Code Review
This pull request modifies the TFLite frontend in Relax to cast gather_nd indices to int64 if they are provided as int32, satisfying the requirements of the Relax gather_nd operator. Additionally, new test cases for gather and gather_nd have been added. The reviewer suggests extending these tests to cover both int32 and int64 indices for both operators to ensure comprehensive coverage.
| verify(ReverseV2, Expected) | ||
|
|
||
|
|
||
| def test_gather(): |
Contributor
| verify(Gather, Expected) | ||
|
|
||
|
|
||
| def test_gather_nd(): |
Contributor
There was a problem hiding this comment.
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.
This adds explicit Expected IRModule coverage for TFLite GATHER and GATHER_ND frontend conversion.
GATHER_ND uses Relax gather_nd with int64 indices, so the frontend now casts int32 TFLite indices to int64 before emitting the Relax op. This keeps the generated module well-typed and matches the expected Relax IR.
Testing:
python -m pytest tests/python/relax/test_frontend_tflite.py -k "gather"related to #18971