File: test_supported_backends.py

package info (click to toggle)
armnn 23.08-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 53,580 kB
  • sloc: cpp: 337,440; python: 4,755; sh: 1,708; makefile: 42; asm: 15; xml: 6
file content (48 lines) | stat: -rw-r--r-- 1,372 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Copyright © 2020 Arm Ltd. All rights reserved.
# SPDX-License-Identifier: MIT
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)