aboutsummaryrefslogtreecommitdiff
path: root/python/pyarmnn/src/pyarmnn/swig/modules/armnn_backend.i
blob: 4d13150a199c8346c70224bf51b1ab3abedf72d1 (plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

%{
#include "armnn/BackendId.hpp"
%}

namespace std {
   %template(BackendIdVector) vector<armnn::BackendId>;
   %template(BackendIdSet) unordered_set<armnn::BackendId>;
}

namespace armnn
{

class BackendId
{
public:
    %feature("docstring",
        "
        Creates backend id instance.
        Supported backend ids: 'CpuRef', 'CpuAcc', 'GpuAcc', 'NpuAcc'.

        Args:
            id (str): Computation backend identification.
        ") BackendId;

    BackendId(const std::string& id);

    %feature("docstring",
        "
        Checks if backend is cpu reference implementation.
        Returns:
            bool: True if backend supports cpu reference implementation, False otherwise.

        ") IsCpuRef;
    bool IsCpuRef();

    %feature("docstring",
        "
        Returns backend identification.

        >>> backendId = BackendId('CpuRef')
        >>> assert 'CpuRef' == str(backendId)
        >>> assert 'CpuRef' == backendId.Get()

        Returns:
            str: Backend identification.

        ") Get;
    const std::string& Get();
};

%extend BackendId {

    std::string __str__() {
        return $self->Get();
    }

}

using BackendIdVector = std::vector<armnn::BackendId>;
using BackendIdSet    = std::unordered_set<armnn::BackendId>;
}