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