aboutsummaryrefslogtreecommitdiff
path: root/python/pyarmnn/test/test_supported_backends.py
diff options
context:
space:
mode:
authorMatthew Bentham <Matthew.Bentham@arm.com>2019-12-02 12:59:43 +0000
committerMatthew Bentham <Matthew.Bentham@arm.com>2019-12-02 16:23:45 +0000
commit245d64c60d0ea30f5080ff53225b5169927e24d6 (patch)
treed623e46d7d5ddb34ef3bb84c45df3ada9209ce82 /python/pyarmnn/test/test_supported_backends.py
parent88d5f9f1615fa956464b8932b574d85c37cec937 (diff)
downloadarmnn-experimental/pyarmnn.tar.gz
Work in progress of python bindings for Arm NNexperimental/pyarmnn
Not built or tested in any way Signed-off-by: Matthew Bentham <Matthew.Bentham@arm.com> Change-Id: Ie7f92b529aa5087130f0c5cc8c17db1581373236
Diffstat (limited to 'python/pyarmnn/test/test_supported_backends.py')
-rw-r--r--python/pyarmnn/test/test_supported_backends.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/python/pyarmnn/test/test_supported_backends.py b/python/pyarmnn/test/test_supported_backends.py
new file mode 100644
index 0000000000..443f8bac08
--- /dev/null
+++ b/python/pyarmnn/test/test_supported_backends.py
@@ -0,0 +1,51 @@
+# Copyright © 2019 Arm Ltd. All rights reserved.
+# SPDX-License-Identifier: MIT.
+import os
+import platform
+import pytest
+import pyarmnn as ann
+
+
+@pytest.fixture()
+def get_supported_backends_setup(shared_data_folder):
+ options = ann.CreationOptions()
+ runtime = ann.IRuntime(options)
+
+ get_device_spec = runtime.GetDeviceSpec()
+ supported_backends = get_device_spec.GetSupportedBackends()
+
+ yield supported_backends
+
+
+def test_ownership():
+ options = ann.CreationOptions()
+ runtime = ann.IRuntime(options)
+
+ device_spec = runtime.GetDeviceSpec()
+
+ assert not device_spec.thisown
+
+
+def test_to_string():
+ options = ann.CreationOptions()
+ runtime = ann.IRuntime(options)
+
+ device_spec = runtime.GetDeviceSpec()
+ expected_str = "IDeviceSpec {{ supportedBackends: [" \
+ "{}" \
+ "]}}".format(', '.join(map(lambda b: str(b), device_spec.GetSupportedBackends())))
+
+ assert expected_str == str(device_spec)
+
+
+def test_get_supported_backends_cpu_ref(get_supported_backends_setup):
+ assert "CpuRef" in map(lambda b: str(b), get_supported_backends_setup)
+
+
+@pytest.mark.juno
+class TestNoneCpuRefBackends:
+
+ @pytest.mark.parametrize("backend",["CpuAcc", "NpuAcc"])
+ def test_get_supported_backends_cpu_acc(self, get_supported_backends_setup, backend):
+ assert backend in map(lambda b: str(b), get_supported_backends_setup)
+