diff options
author | Richard Burton <richard.burton@arm.com> | 2020-04-08 16:39:05 +0100 |
---|---|---|
committer | Jim Flynn <jim.flynn@arm.com> | 2020-04-10 16:11:09 +0000 |
commit | dc0c6ed9f8b993e63f492f203d7d7080ab4c835c (patch) | |
tree | ea8541990b13ebf1a038009aa6b8b4b1ea8c3f55 /python/pyarmnn/test/test_supported_backends.py | |
parent | fe5a24beeef6e9a41366e694f41093565e748048 (diff) | |
download | armnn-dc0c6ed9f8b993e63f492f203d7d7080ab4c835c.tar.gz |
Add PyArmNN to work with ArmNN API of 20.02
* Add Swig rules for generating python wrapper
* Add documentation
* Add tests and testing data
Change-Id: If48eda08931514fa21e72214dfead2835f07237c
Signed-off-by: Richard Burton <richard.burton@arm.com>
Signed-off-by: Derek Lamberti <derek.lamberti@arm.com>
Diffstat (limited to 'python/pyarmnn/test/test_supported_backends.py')
-rw-r--r-- | python/pyarmnn/test/test_supported_backends.py | 50 |
1 files changed, 50 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..e1ca5ee6df --- /dev/null +++ b/python/pyarmnn/test/test_supported_backends.py @@ -0,0 +1,50 @@ +# Copyright © 2020 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.aarch64 +class TestNoneCpuRefBackends: + + @pytest.mark.parametrize("backend", ["CpuAcc"]) + 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) |