Compute Library
 23.11
CLCopy.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-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_CLCOPY_H
25 #define ARM_COMPUTE_CLCOPY_H
26 
27 #include "arm_compute/core/Types.h"
30 
31 #include <memory>
32 
33 namespace arm_compute
34 {
35 class CLCompileContext;
36 class ICLTensor;
37 class ITensorInfo;
38 
39 /** Basic function to run @ref opencl::kernels::ClCopyKernel */
40 class CLCopy : public IFunction
41 {
42 public:
43  /** Constructor */
44  CLCopy();
45  /** Destructor */
46  ~CLCopy();
47  /** Prevent instances of this class from being copied (As this class contains pointers) */
48  CLCopy(const CLCopy &) = delete;
49  /** Default move constructor */
50  CLCopy(CLCopy &&);
51  /** Prevent instances of this class from being copied (As this class contains pointers) */
52  CLCopy &operator=(const CLCopy &) = delete;
53  /** Default move assignment operator */
54  CLCopy &operator=(CLCopy &&);
55  /** Initialise the function's source and destination.
56  *
57  * Valid data layouts:
58  * - All
59  *
60  * Valid data type configurations:
61  * |src |dst |
62  * |:--------------|:--------------|
63  * |All |All |
64  *
65  * @param[in] input Source tensor. Data types supported: All.
66  * @param[out] output Output tensor. Data types supported: Same as @p input.
67  * @param[in] dst_window (Optional) Window to be used in case only copying into part of a tensor. Default is nullptr.
68  */
69  void configure(ICLTensor *input, ICLTensor *output, Window *dst_window = nullptr);
70  /** Initialise the function's source and destination.
71  *
72  * @param[in] compile_context The compile context to be used.
73  * @param[in] input Source tensor. Data types supported: All.
74  * @param[out] output Output tensor. Data types supported: Same as @p input.
75  * @param[in] dst_window (Optional) Window to be used in case only copying into part of a tensor. Default is nullptr.
76  *
77  */
78  void configure(const CLCompileContext &compile_context,
80  ICLTensor *output,
81  Window *dst_window = nullptr);
82  /** Static function to check if given info will lead to a valid configuration of @ref CLCopy
83  *
84  * @param[in] input Source tensor. Data types supported: All.
85  * @param[in] output Output tensor. Data types supported: Same as @p input.
86  * @param[in] dst_window (Optional) Window to be used in case only copying into part of a tensor. Default is nullptr.
87  *
88  * @return a status
89  */
90  static Status validate(const ITensorInfo *input, const ITensorInfo *output, Window *dst_window = nullptr);
91 
92  // Inherited methods overridden:
93  void run() override;
94 
95 private:
96  struct Impl;
97  std::unique_ptr<Impl> _impl;
98 };
99 } // namespace arm_compute
100 #endif /*ARM_COMPUTE_CLCOPY_H */
arm_compute::IFunction
Base class for all functions.
Definition: IFunction.h:30
Types.h
Window.h
arm_compute::CLCopy::~CLCopy
~CLCopy()
Destructor.
arm_compute::ICLTensor
Interface for OpenCL tensor.
Definition: ICLTensor.h:41
arm_compute::CLCopy::configure
void configure(ICLTensor *input, ICLTensor *output, Window *dst_window=nullptr)
Initialise the function's source and destination.
Definition: CLCopy.cpp:53
arm_compute::CLCompileContext
CLCompileContext class.
Definition: CLCompileContext.h:204
arm_compute::Status
Status class.
Definition: Error.h:52
arm_compute::CLCopy
Basic function to run opencl::kernels::ClCopyKernel.
Definition: CLCopy.h:40
IFunction.h
arm_compute::CLCopy::validate
static Status validate(const ITensorInfo *input, const ITensorInfo *output, Window *dst_window=nullptr)
Static function to check if given info will lead to a valid configuration of CLCopy.
Definition: CLCopy.cpp:70
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::ITensorInfo
Store the tensor's metadata.
Definition: ITensorInfo.h:44
arm_compute::CLCopy::run
void run() override
Run the kernels contained in the function.
Definition: CLCopy.cpp:75
arm_compute::CLCopy::operator=
CLCopy & operator=(const CLCopy &)=delete
Prevent instances of this class from being copied (As this class contains pointers)
arm_compute::test::validation::input
auto input
Definition: LSTMLayerQuantized.cpp:486
arm_compute::CLCopy::CLCopy
CLCopy()
Constructor.
Definition: CLCopy.cpp:46