From e17ec132cdc4fb40a3f9f78dc9b9bff6ccc04ff9 Mon Sep 17 00:00:00 2001 From: Henry Hsieh Date: Sun, 13 Jul 2025 16:14:02 +0800 Subject: [PATCH 1/2] [BugFix][NNAPI] Fix type mismatch in NNAPICompiler This commit explicitly casts the `tvm::ffi::Any` returned by `runtime.nnapi_runtime_create` to `tvm::runtime::Module` before adding it to the `Array` in response to the recent FFI refactor (commit 2d964b4) that phased out the legacy C API. Co-authored-by: HMZ --- src/relax/backend/contrib/nnapi/codegen.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/relax/backend/contrib/nnapi/codegen.cc b/src/relax/backend/contrib/nnapi/codegen.cc index d9f26c417257..5e95f375d2d0 100644 --- a/src/relax/backend/contrib/nnapi/codegen.cc +++ b/src/relax/backend/contrib/nnapi/codegen.cc @@ -258,7 +258,9 @@ Array NNAPICompiler(Array functions, Map(); + compiled_functions.push_back(mod); } return compiled_functions; From d46c390349a7503b5be916454cd92761a7738523 Mon Sep 17 00:00:00 2001 From: Henry Hsieh Date: Sun, 13 Jul 2025 17:04:51 +0800 Subject: [PATCH 2/2] [BugFix][NNAPI] Fix annotation in test_mean This commit corrects the StructInfo annotation of the tensor returned by `R.mean` from `(1, 10, 15)` to `(1, 10, 1)` to match the actual output shape. Co-authored-by: HMZ --- tests/python/nightly/test_nnapi/test_ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/python/nightly/test_nnapi/test_ops.py b/tests/python/nightly/test_nnapi/test_ops.py index 31d584db1396..a6837d2ce5c1 100644 --- a/tests/python/nightly/test_nnapi/test_ops.py +++ b/tests/python/nightly/test_nnapi/test_ops.py @@ -272,7 +272,7 @@ def main( ) -> R.Tensor((1, 10, 1), "float32"): n = T.int64() with R.dataflow(): - t0: R.Tensor((1, 10, 15), "float32") = R.mean(i0, axis=[-1], keepdims=True) + t0: R.Tensor((1, 10, 1), "float32") = R.mean(i0, axis=[-1], keepdims=True) R.output(t0) return t0