This is an automated email from the ASF dual-hosted git repository.
leandron pushed a commit to branch ci-docker-staging
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/ci-docker-staging by this push:
new 2006d44798 [ACL] Adjust mobilenet test for Keras 2.9
2006d44798 is described below
commit 2006d44798481b8bf7ba685aeb9c7c2183d203ba
Author: Leandro Nunes <[email protected]>
AuthorDate: Mon Aug 22 16:37:43 2022 +0100
[ACL] Adjust mobilenet test for Keras 2.9
In Keras 2.7, one "reshape" operator was removed from
the Mobilenet model, making our test which verifies the
number of operators to be incorrect.
This patch adjusts the operator count so that it is in line
with the changes in Keras. For reference, the change in
keras repo was done in hash b6abfaed132 "Remove unnecessary
reshape layer in MobileNet architecture".
Change-Id: I08b2078b54b60e710ab281b7ecb7e3e2cf1865d9
---
.../contrib/test_arm_compute_lib/test_network.py | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/tests/python/contrib/test_arm_compute_lib/test_network.py
b/tests/python/contrib/test_arm_compute_lib/test_network.py
index 8fcafe489c..b5b9ed6b6e 100644
--- a/tests/python/contrib/test_arm_compute_lib/test_network.py
+++ b/tests/python/contrib/test_arm_compute_lib/test_network.py
@@ -16,6 +16,8 @@
# under the License.
"""Arm Compute Library network tests."""
+from distutils.version import LooseVersion
+
import numpy as np
import pytest
from tvm import testing
@@ -111,6 +113,7 @@ def test_vgg16():
def test_mobilenet():
+ keras = pytest.importorskip("keras")
Device.load("test_config.json")
if skip_runtime_test():
@@ -131,8 +134,25 @@ def test_mobilenet():
mod, params = _get_keras_model(mobilenet, inputs)
return mod, params, inputs
+ if keras.__version__ < LooseVersion("2.9"):
+ # This can be removed after we migrate to TF/Keras >= 2.9
+ expected_tvm_ops = 56
+ expected_acl_partitions = 31
+ else:
+ # In Keras >= 2.7, one reshape operator was removed
+ # from the MobileNet model, so it impacted this test
+ # which now needs to be reduce in by 1
+ # The change in Keras is `b6abfaed1326e3c`
+ expected_tvm_ops = 55
+ expected_acl_partitions = 30
+
_build_and_run_network(
- *get_model(), device=device, tvm_ops=56, acl_partitions=31,
atol=0.002, rtol=0.01
+ *get_model(),
+ device=device,
+ tvm_ops=expected_tvm_ops,
+ acl_partitions=expected_acl_partitions,
+ atol=0.002,
+ rtol=0.01,
)