Aharrypotter opened a new pull request, #19814:
URL: https://github.com/apache/tvm/pull/19814
## Summary
Adds Relax TFLite frontend coverage for the remaining unchecked
non-quantized operator tests tracked in #18971:
- `SQUEEZE`
- `REVERSE_SEQUENCE`
- `UNPACK`
- `ZEROS_LIKE`
The tests use small hand-built TFLite flatbuffers and compare the generated
Relax IR with explicit Expected IRModules. This avoids TensorFlow Lite
converter optimizations that rewrite `SQUEEZE` to `RESHAPE` or fold
`ZEROS_LIKE`, and keeps the operator-focused tests tied directly to the
target
TFLite builtin operators.
## Changes
- Add minimal TFLite flatbuffer builders for:
- `SQUEEZE` with `SqueezeOptions`
- `REVERSE_SEQUENCE` with `ReverseSequenceOptions`
- `UNPACK` with `UnpackOptions`
- `ZEROS_LIKE` with `ZerosLikeOptions`
- Add structural Relax IR tests for the four operators in
`tests/python/relax/test_frontend_tflite.py`.
- Fix `REVERSE_SEQUENCE` lowering to use the existing
`topi.reverse_sequence` DPS packed path instead of the nonexistent
`relax.op.reverse_sequence` Python op.
- Guard `REVERSE_SEQUENCE` with non-zero `batch_dim` as unsupported, matching
the currently available TOPI packed wrapper.
- Fix `UNPACK` lowering to build tuple outputs using explicit
`TupleGetItem(split_result, i)` access, avoiding Python iteration over a
Relax expression.
## Tests
Local validation:
```bash
conda run -n tvm-dev bash -lc 'export
PYTHONPATH="$(pwd)/python:$(pwd)/.local/python"; python -m ruff format
python/tvm/relax/frontend/tflite/tflite_frontend.py
tests/python/relax/test_frontend_tflite.py'
conda run -n tvm-dev bash -lc 'export
PYTHONPATH="$(pwd)/python:$(pwd)/.local/python"; python -m ruff check
python/tvm/relax/frontend/tflite/tflite_frontend.py
tests/python/relax/test_frontend_tflite.py'
conda run -n tvm-dev bash -lc 'export
PYTHONPATH="$(pwd)/python:$(pwd)/.local/python"; python -m pytest
tests/python/relax/test_frontend_tflite.py -k "squeeze or reverse_sequence or
unpack or zeros_like" -q'
conda run -n tvm-dev bash -lc 'export
PYTHONPATH="$(pwd)/python:$(pwd)/.local/python"; python -m pytest
tests/python/relax/test_frontend_tflite.py -q'
```
Result:
```text
ruff format: 1 file reformatted, 1 file left unchanged
ruff check: All checks passed
target pytest: 4 passed, 523 deselected
full TFLite pytest: 527 passed
```
## References
- Tracking issue #18971: TFLite non-quantized operator unit-test coverage
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]