Compute Library
 23.11
INEOperator.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020-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  */
24 #ifndef ARM_COMPUTE_INEOPERATOR_H
25 #define ARM_COMPUTE_INEOPERATOR_H
26 
30 
31 #include "../../core/ITensor.h"
32 #include <memory>
33 
34 namespace arm_compute
35 {
36 class ICPPKernel;
37 class Window;
38 
40 namespace experimental
41 {
42 /** Basic interface for functions which have a single async CPU kernel */
43 class INEOperator : public IOperator
44 {
45 public:
46  /** Constructor
47  *
48  * @param[in] ctx Runtime context to be used by the function
49  */
50  INEOperator(IRuntimeContext *ctx = nullptr);
51  /** Prevent instances of this class from being copied (As this class contains pointers) */
52  INEOperator(const INEOperator &) = delete;
53  /** Default move constructor */
54  INEOperator(INEOperator &&) = default;
55  /** Prevent instances of this class from being copied (As this class contains pointers) */
56  INEOperator &operator=(const INEOperator &) = delete;
57  /** Default move assignment operator */
58  INEOperator &operator=(INEOperator &&) = default;
59  /** Default destructor */
60  ~INEOperator();
61 
62  // Inherited methods overridden:
63  void run(ITensorPack &tensors) override;
64  void prepare(ITensorPack &constants) override;
65  MemoryRequirements workspace() const override;
66 
67 protected:
68  void run(ITensorPack &tensors, const Window &window);
69 
70  std::unique_ptr<INEKernel> _kernel;
71  IRuntimeContext *_ctx;
72  MemoryRequirements _workspace;
73 };
74 } // namespace experimental
75 } // namespace arm_compute
76 #endif /*ARM_COMPUTE_INEOPERATOR_H */
arm_compute::experimental::MemoryRequirements
std::vector< MemoryInfo > MemoryRequirements
Definition: Types.h:123
Types.h
arm_compute::experimental::INEOperator::INEOperator
INEOperator(IRuntimeContext *ctx=nullptr)
Constructor.
Definition: INEOperator.cpp:37
arm_compute::ITensorPack
Tensor packing service.
Definition: ITensorPack.h:39
arm_compute::ICPPKernel
Common interface for all kernels implemented in C++.
Definition: ICPPKernel.h:38
arm_compute::experimental::INEOperator
Basic interface for functions which have a single async CPU kernel.
Definition: INEOperator.h:43
arm_compute::IRuntimeContext
Context interface.
Definition: IRuntimeContext.h:34
arm_compute::experimental::INEOperator::run
void run(ITensorPack &tensors) override
Run the kernels contained in the function.
Definition: INEOperator.cpp:41
arm_compute::experimental::INEOperator::operator=
INEOperator & operator=(const INEOperator &)=delete
Prevent instances of this class from being copied (As this class contains pointers)
arm_compute::Window
Describe a multidimensional execution window.
Definition: Window.h:39
arm_compute
Copyright (c) 2017-2023 Arm Limited.
Definition: introduction.dox:24
arm_compute::experimental::INEOperator::prepare
void prepare(ITensorPack &constants) override
Prepare the function for executing.
Definition: INEOperator.cpp:56
arm_compute::experimental::INEOperator::~INEOperator
~INEOperator()
Default destructor.
arm_compute::experimental::IOperator
Base class for all async functions.
Definition: IOperator.h:37
IOperator.h
IRuntimeContext.h
arm_compute::experimental::INEOperator::workspace
MemoryRequirements workspace() const override
Return the memory requirements required by the workspace.
Definition: INEOperator.cpp:61