1# Copyright © 2020 Arm Ltd. All rights reserved. 2# SPDX-License-Identifier: MIT 3import pytest 4import pyarmnn as ann 5 6 7@pytest.fixture() 8def get_supported_backends_setup(shared_data_folder): 9 options = ann.CreationOptions() 10 runtime = ann.IRuntime(options) 11 12 get_device_spec = runtime.GetDeviceSpec() 13 supported_backends = get_device_spec.GetSupportedBackends() 14 15 yield supported_backends 16 17 18def test_ownership(): 19 options = ann.CreationOptions() 20 runtime = ann.IRuntime(options) 21 22 device_spec = runtime.GetDeviceSpec() 23 24 assert not device_spec.thisown 25 26 27def test_to_string(): 28 options = ann.CreationOptions() 29 runtime = ann.IRuntime(options) 30 31 device_spec = runtime.GetDeviceSpec() 32 expected_str = "IDeviceSpec {{ supportedBackends: [" \ 33 "{}" \ 34 "]}}".format(', '.join(map(lambda b: str(b), device_spec.GetSupportedBackends()))) 35 36 assert expected_str == str(device_spec) 37 38 39def test_get_supported_backends_cpu_ref(get_supported_backends_setup): 40 assert "CpuRef" in map(lambda b: str(b), get_supported_backends_setup) 41 42 43@pytest.mark.aarch64 44class TestNoneCpuRefBackends: 45 46 @pytest.mark.parametrize("backend", ["CpuAcc"]) 47 def test_get_supported_backends_cpu_acc(self, get_supported_backends_setup, backend): 48 assert backend in map(lambda b: str(b), get_supported_backends_setup) 49