From 245d64c60d0ea30f5080ff53225b5169927e24d6 Mon Sep 17 00:00:00 2001 From: Matthew Bentham Date: Mon, 2 Dec 2019 12:59:43 +0000 Subject: Work in progress of python bindings for Arm NN Not built or tested in any way Signed-off-by: Matthew Bentham Change-Id: Ie7f92b529aa5087130f0c5cc8c17db1581373236 --- .../src/pyarmnn/swig/modules/armnn_backend.i | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 python/pyarmnn/src/pyarmnn/swig/modules/armnn_backend.i (limited to 'python/pyarmnn/src/pyarmnn/swig/modules/armnn_backend.i') diff --git a/python/pyarmnn/src/pyarmnn/swig/modules/armnn_backend.i b/python/pyarmnn/src/pyarmnn/swig/modules/armnn_backend.i new file mode 100644 index 0000000000..4d13150a19 --- /dev/null +++ b/python/pyarmnn/src/pyarmnn/swig/modules/armnn_backend.i @@ -0,0 +1,66 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +%{ +#include "armnn/BackendId.hpp" +%} + +namespace std { + %template(BackendIdVector) vector; + %template(BackendIdSet) unordered_set; +} + +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; +using BackendIdSet = std::unordered_set; +} -- cgit v1.2.1