From f76040decf649742df949c490671641f571e2aa9 Mon Sep 17 00:00:00 2001 From: Chris Sidebottom Date: Sat, 30 Oct 2021 15:35:39 +0100 Subject: [PATCH] Update NPU tests with new sanitisation --- .../python/contrib/test_ethosn/infrastructure.py | 16 ++++++++++++---- .../python/contrib/test_ethosn/test_networks.py | 16 ++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/tests/python/contrib/test_ethosn/infrastructure.py b/tests/python/contrib/test_ethosn/infrastructure.py index c284f6488bfb0..f16c37fe19af6 100644 --- a/tests/python/contrib/test_ethosn/infrastructure.py +++ b/tests/python/contrib/test_ethosn/infrastructure.py @@ -170,11 +170,19 @@ def build(mod, params, npu=True, expected_host_ops=0, npu_partitions=1): assert ( host_op_count == expected_host_ops ), "Got {} host operators, expected {}".format(host_op_count, expected_host_ops) - partition_count = 0 - for global_var in mod.get_global_vars(): - if "ethos-n" in global_var.name_hint: - partition_count += 1 + attrs = [ + mod[var.name_hint].attrs + for var in mod.get_global_vars() + if mod[var.name_hint].attrs + ] + partition_count = sum( + [ + key == "Compiler" and value == "ethos-n" + for attr in attrs + for key, value in attr.items() + ] + ) assert ( npu_partitions == partition_count ), "Got {} ethos-n partitions, expected {}".format(partition_count, npu_partitions) diff --git a/tests/python/contrib/test_ethosn/test_networks.py b/tests/python/contrib/test_ethosn/test_networks.py index f720c55c567a1..3a8b95496fdea 100644 --- a/tests/python/contrib/test_ethosn/test_networks.py +++ b/tests/python/contrib/test_ethosn/test_networks.py @@ -123,9 +123,9 @@ def test_mobilenet_v1(): # codegen, which could come about from either a change in Support Library # version or a change in the Ethos-N codegen. To update this requires running # on hardware that isn't available in CI. - _compile_hash = {"1fd4ef29a1ea9f3a015cab87c0b8014a"} + _compile_hash = {"0433d3c3947a067b36f0228bdb5f1838"} if tei.get_ethosn_variant() == "Ethos-N78_1TOPS_2PLE_RATIO": - _compile_hash = {"b879dfbff1f907eaf6129dfd41b44ece"} + _compile_hash = {"e4ed29dceb1187505948ab17fc3cc6d6"} if tei.get_ethosn_api_version() == 2011: _compile_hash = {"9c9f63b30824f5b223cdb27d2f22c857"} if tei.get_ethosn_variant() == "Ethos-N78_1TOPS_2PLE_RATIO": @@ -150,9 +150,9 @@ def test_inception_v3(): # codegen, which could come about from either a change in Support Library # version or a change in the Ethos-N codegen. To update this requires running # on hardware that isn't available in CI. - _compile_hash = {"b90ed315639c6a0e97584c2dbc42a55c"} + _compile_hash = {"43dc2097127eb224c0191b1a15f8acca"} if tei.get_ethosn_variant() == "Ethos-N78_1TOPS_2PLE_RATIO": - _compile_hash = {"5693569055695e581a8739194d0301aa"} + _compile_hash = {"7db23387bdc5af6eaa1ae3f7d456caf0"} if tei.get_ethosn_api_version() == 2011: _compile_hash = {"46ccafc840633633aca441645e41b444"} if tei.get_ethosn_variant() == "Ethos-N78_1TOPS_2PLE_RATIO": @@ -176,9 +176,9 @@ def test_inception_v4(): # codegen, which could come about from either a change in Support Library # version or a change in the Ethos-N codegen. To update this requires running # on hardware that isn't available in CI. - _compile_hash = {"b36877d2386d9f9c37a11772e3c4072c"} + _compile_hash = {"fab6c2297502f95d33079c6ce1a737f9"} if tei.get_ethosn_variant() == "Ethos-N78_1TOPS_2PLE_RATIO": - _compile_hash = {"b5046a6f56d78af0b4f51960bf2deeda"} + _compile_hash = {"8da68849b75613ac3dffd3fff2dd87da"} if tei.get_ethosn_api_version() == 2011: _compile_hash = {"4a1a56393078367dd27915a188d6a6af"} if tei.get_ethosn_variant() == "Ethos-N78_1TOPS_2PLE_RATIO": @@ -202,9 +202,9 @@ def test_ssd_mobilenet_v1(): # codegen, which could come about from either a change in Support Library # version or a change in the Ethos-N codegen. To update this requires running # on hardware that isn't available in CI. - _compile_hash = {"956caf9e7fe5cfd5c042bd17857f7407", "4313033d14328e2aa022b1bd71b27b1c"} + _compile_hash = {"2345cf5d6c0013bad7c76dcccee9d862", "7795b6c67178da9d1f9b98063bad75b1"} if tei.get_ethosn_variant() == "Ethos-N78_1TOPS_2PLE_RATIO": - _compile_hash = {"dc60cc687d892cd2877873094e9dfc0b", "6b3deeec16c24c0dcef23df0db5fb162"} + _compile_hash = {"928dc6ae5ce49a4ad63ca87f7575970f", "b092f9820f7e9341fc53daa781b98772"} if tei.get_ethosn_api_version() == 2011: _compile_hash = {"10826406ae724e52f360a06c35ced09d", "9a484d5ecec7acb18c9d6bc6058be031"} if tei.get_ethosn_variant() == "Ethos-N78_1TOPS_2PLE_RATIO":