Open rafzi opened 2 years ago
I'd suggest saving / writing out the tflite model to inspect what actually gets generated in this particular case from the use of math_ops.matmul in the framework. I suspect that produces a matmul operator rather than a batch_matmul operator in the framework , however producing it from the test might be the only way of looking at what is actually being consumed by the frontend .
That certainly looks puzzling.
Ah, came in with this https://github.com/apache/tvm/pull/5510. Perhaps that helps in archeology and identifying the possibly misnamed tests.
Yes, you are right. The models produced by the test do not contain the operator.
As far as I can tell, the math_ops.matmul function should produce a batch_matmul for certain parameters. I'll try to figure the specifics out. Thank you!
The following transformation seems to unroll all BatchMatMul ops to MatMul:
Using the MLIR converter switches from Slice to Split, but still does the unrolling:
So as far as I can tell it does not seem possible to generate the BatchMatMul op using the current converter. Maybe the model I referred to was created with an earlier version that did not employ this transformation?
I was working on adding support for the TFLite op
Batch_MatMul
. When looking at the tests, I was a bit puzzled as to why there was already a test for that operator and why it is passing.https://github.com/apache/tvm/blob/main/tests/python/frontend/tflite/test_forward.py#L726
When I'm trying a model ( https://github.com/huggingface/tflite-android-transformers/blob/master/models_generation/gpt2.py using
distilgpt2
) with the op, I get the expected error:The whole TFLite frontend test file is not quite clear to me. How would I then test that my new operator is converted correctly? It would be great if someone could clarify or add documentation.
@FrozenGene @u99127 @siju-samuel