This is an automated email from the ASF dual-hosted git repository.

tlopex pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 78b7286d32 fix: TFLite model retrieval with error handling (#19347)
78b7286d32 is described below

commit 78b7286d323fa991b18012f7e16fb14d7ee773c4
Author: Bana <[email protected]>
AuthorDate: Sat Apr 4 18:38:15 2026 +0300

    fix: TFLite model retrieval with error handling (#19347)
    
    closes #19346
---
 tests/python/relax/test_frontend_tflite.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/python/relax/test_frontend_tflite.py 
b/tests/python/relax/test_frontend_tflite.py
index dd43c9030b..05ca3e4270 100644
--- a/tests/python/relax/test_frontend_tflite.py
+++ b/tests/python/relax/test_frontend_tflite.py
@@ -40,7 +40,11 @@ def _get_mod_from_cfunc(cfunc):
         tf.lite.OpsSet.SELECT_TF_OPS,
     ]
 
-    tflite_model = tflite.Model.Model.GetRootAsModel(converter.convert(), 0)
+    tflite_model_buf = converter.convert()
+    if hasattr(tflite.Model, "Model"):
+        tflite_model = tflite.Model.Model.GetRootAsModel(tflite_model_buf, 0)
+    else:
+        tflite_model = tflite.Model.GetRootAsModel(tflite_model_buf, 0)
     mod = from_tflite(tflite_model)
     mod["main"] = mod["main"].without_attr("params")
     return mod

Reply via email to