• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2020 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 %{
6 #include "armnn/BackendId.hpp"
7 %}
8 
9 namespace std {
10    %template(BackendIdVector) vector<armnn::BackendId>;
11    %template(BackendIdSet) unordered_set<armnn::BackendId>;
12 }
13 
14 namespace armnn
15 {
16 
17 class BackendId
18 {
19 public:
20     %feature("docstring",
21         "
22         Creates backend id instance.
23         Supported backend ids: 'CpuRef', 'CpuAcc', 'GpuAcc', 'EthosNAcc'.
24 
25         Args:
26             id (str): Computation backend identification.
27         ") BackendId;
28 
29     BackendId(const std::string& id);
30 
31     %feature("docstring",
32         "
33         Checks if backend is cpu reference implementation.
34         Returns:
35             bool: True if backend supports cpu reference implementation, False otherwise.
36 
37         ") IsCpuRef;
38     bool IsCpuRef();
39 
40     %feature("docstring",
41         "
42         Returns backend identification.
43 
44         >>> backendId = BackendId('CpuRef')
45         >>> assert 'CpuRef' == str(backendId)
46         >>> assert 'CpuRef' == backendId.Get()
47 
48         Returns:
49             str: Backend identification.
50 
51         ") Get;
52     const std::string& Get();
53 };
54 
55 %extend BackendId {
56 
__str__()57     std::string __str__() {
58         return $self->Get();
59     }
60 
61 }
62 
63 using BackendIdVector = std::vector<armnn::BackendId>;
64 using BackendIdSet    = std::unordered_set<armnn::BackendId>;
65 }
66