Compute Library
 21.11
AclOperator.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Arm Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
25 
26 #include "src/common/IOperator.h"
27 #include "src/common/IQueue.h"
28 #include "src/common/TensorPack.h"
30 
31 extern "C" AclStatus AclRunOperator(AclOperator external_op, AclQueue external_queue, AclTensorPack external_tensors)
32 {
33  using namespace arm_compute;
34 
35  auto op = get_internal(external_op);
36  auto queue = get_internal(external_queue);
37  auto pack = get_internal(external_tensors);
38 
42  status = detail::validate_internal_queue(queue);
46 
47  status = op->run(*queue, pack->get_tensor_pack());
49 
50  return AclSuccess;
51 }
52 
53 extern "C" AclStatus AclDestroyOperator(AclOperator external_op)
54 {
55  using namespace arm_compute;
56 
57  auto op = get_internal(external_op);
58 
61 
62  delete op;
63 
64  return AclSuccess;
65 }
#define ARM_COMPUTE_RETURN_CENUM_ON_FAILURE(status)
Definition: Macros.h:29
Copyright (c) 2017-2021 Arm Limited.
StatusCode validate_internal_operator(const IOperator *op)
Check if an internal operator is valid.
Definition: IOperator.h:125
StatusCode validate_internal_queue(const IQueue *queue)
Check if an internal queue is valid.
Definition: IQueue.h:89
Call succeeded, leading to valid state for all involved objects/data.
Definition: AclTypes.h:51
AclStatus AclRunOperator(AclOperator external_op, AclQueue external_queue, AclTensorPack external_tensors)
Eager execution of a given operator on a list of inputs and outputs.
Definition: AclOperator.cpp:31
StatusCode
Definition: Types.h:32
AclStatus AclDestroyOperator(AclOperator external_op)
Destroy a given operator object.
Definition: AclOperator.cpp:53
StatusCode validate_internal_pack(const TensorPack *pack)
Check if an internal TensorPack is valid.
Definition: TensorPack.h:119
IContext * get_internal(AclContext ctx)
Extract internal representation of a Context.
Definition: IContext.h:127
AclStatus
Definition: AclTypes.h:49