Aharrypotter opened a new pull request, #19859:
URL: https://github.com/apache/tvm/pull/19859

   ## Summary
   
   This PR adds explicit Relax TFLite frontend coverage for the remaining legacy
   embedding operators from #19519 group D:
   
   - `CONCAT_EMBEDDINGS`
   - `LSH_PROJECTION`
   - `SKIP_GRAM`
   
   These are legacy or string/hash-dependent TFLite builtins rather than direct
   Relax tensor operator mappings. The frontend now recognizes them through
   dedicated handlers, validates the operator options and tensor metadata that 
can
   be checked safely at import time, and raises targeted `OpNotImplemented`
   diagnostics instead of falling through to the generic unsupported-operator 
path.
   
   ## Design
   
   `CONCAT_EMBEDDINGS` parses `ConcatEmbeddingsOptions` and validates the 
channel
   metadata before rejecting the legacy embedding semantics. This keeps 
malformed
   models distinguishable from unsupported-but-recognized models.
   
   `LSH_PROJECTION` parses `LSHProjectionOptions`, validates the 
hash/input/weight
   arity, supported projection type, output dtype, and projection-dependent 
output
   shape. It remains unsupported because correct lowering requires TensorFlow
   Lite's fingerprint hash semantics.
   
   `SKIP_GRAM` parses `SkipGramOptions` and validates the string input/output
   contract. It remains unsupported because the Relax TFLite frontend does not 
yet
   model `TensorType.STRING`.
   
   ## Tests
   
   The tests manually build minimal TFLite flatbuffers for each legacy operator
   and assert that import raises the targeted diagnostic.
   
   Local validation:
   
   ```bash
   python -m ruff format \
     python/tvm/relax/frontend/tflite/tflite_frontend.py \
     tests/python/relax/test_frontend_tflite.py
   
   python -m ruff check \
     python/tvm/relax/frontend/tflite/tflite_frontend.py \
     tests/python/relax/test_frontend_tflite.py
   
   python -m pytest \
     tests/python/relax/test_frontend_tflite.py \
     -k "concat_embeddings or lsh_projection or skip_gram" \
     -q
   
   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
   targeted legacy embedding tests: 3 passed, 545 deselected
   full test_frontend_tflite.py: 548 passed
   ```
   
   ## References
   
   - Issue #19519 item D: legacy embedding / sparse embedding operators
   - Issue comment: 
https://github.com/apache/tvm/issues/19519#issuecomment-4764085992
   


-- 
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]

Reply via email to