[Tests][Frontend] Remove redundant PyTorch frontend tests#20021
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors and simplifies frontend tests across test_frontend_from_exported_program.py and test_frontend_from_fx.py by removing redundant test cases, while also adding new test coverage for static broadcasts and constant gather operations in test_frontend_tflite.py. However, the feedback highlights that several deleted test cases should be retained to prevent a significant loss of test coverage. Specifically, the reviewer recommends preserving tests for torch.unbind, multi-dimensional IndexPut, functional bitwise_or, negative axis handling in torch.gather, and factory operators (arange, empty, eye, and linspace) in the FX frontend, as these exercise distinct code paths and operator behaviors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
I am having trouble creating individual review comments. Click here to see my feedback.
tests/python/relax/test_frontend_from_exported_program.py (5797-5800)
Removing Unbind1 and Unbind2 completely eliminates test coverage for torch.unbind in the exported program frontend. Unlike torch.chunk or torch.split which retain the split dimension (e.g., returning size 1), torch.unbind squeezes the split dimension. This exercises a distinct lowering path involving R.squeeze that is not covered by Chunk. Please preserve the unbind test cases.
tests/python/relax/test_frontend_from_fx.py (5794-5806)
Removing multi-dimensional IndexPut tests (IndexPut2D, IndexPut3D, etc.) leaves only 1D indexing covered. Multi-dimensional advanced indexing (where the indices tuple contains multiple tensors) is significantly more complex than 1D indexing and exercises different code paths in the FX importer and Relax backend. Please retain at least one multi-dimensional IndexPut test case.
tests/python/relax/test_frontend_from_exported_program.py (1284-1289)
Removing (torch.ops.aten.bitwise_or, R.bitwise_or) while keeping the in-place version bitwise_or_ is problematic. Functional bitwise_or (e.g., x | y) is far more common in user models than the in-place version. Removing it leaves the standard functional path completely untested in the exported program frontend. Please retain the functional bitwise_or test case.
tests/python/relax/test_frontend_from_fx.py (4404-4412)
Removing test_arange and test_empty completely removes coverage for these factory operators in the FX frontend (from_fx). While they might be tested in the exported program frontend, the FX frontend is a separate importer with its own translation logic. Removing these tests leaves these common operators completely untested in the FX frontend.
tests/python/relax/test_frontend_from_fx.py (5699-5710)
Removing Gather1, Gather2, and Gather3 leaves only Gather0 (axis 0). Negative axis handling (e.g., dim=-1, dim=-2) is a frequent source of bugs in deep learning compilers due to axis normalization requirements. Removing these cases eliminates coverage for negative axis normalization in torch.gather.
tests/python/relax/test_frontend_from_fx.py (6716-6721)
Removing test_eye and test_linspace completely removes coverage for these factory operators in the FX frontend. Please retain these tests to prevent silent regressions in the FX importer.
This PR: