diff options
Diffstat (limited to 'arm_compute/runtime/CL/functions/CLFill.h')
-rw-r--r-- | arm_compute/runtime/CL/functions/CLFill.h | 69 |
1 files changed, 57 insertions, 12 deletions
diff --git a/arm_compute/runtime/CL/functions/CLFill.h b/arm_compute/runtime/CL/functions/CLFill.h index bb1216054f..be1059761a 100644 --- a/arm_compute/runtime/CL/functions/CLFill.h +++ b/arm_compute/runtime/CL/functions/CLFill.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 ARM Limited. + * Copyright (c) 2019-2021, 2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -26,29 +26,74 @@ #include "arm_compute/core/PixelValue.h" #include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" +#include "arm_compute/core/Window.h" +#include "arm_compute/runtime/IFunction.h" + +#include <memory> namespace arm_compute { +class CLCompileContext; class ICLTensor; -/** Function to run @ref CLMemsetKernel to fill a tensor with a scalar value */ -class CLFill : public ICLSimpleFunction +/** Basic function to run @ref opencl::kernels::ClFillKernel */ +class CLFill : public IFunction { public: - /** Initialize the function + /** Constructor */ + CLFill(); + /** Destructor */ + ~CLFill(); + /** Prevent instances of this class from being copied (As this class contains pointers) */ + CLFill(const CLFill &) = delete; + /** Default move constructor */ + CLFill(CLFill &&); + /** Prevent instances of this class from being copied (As this class contains pointers) */ + CLFill &operator=(const CLFill &) = delete; + /** Default move assignment operator */ + CLFill &operator=(CLFill &&); + /** Initialize the kernel's tensor and filling value + * + * Valid data layouts: + * - All * - * @param[in,out] tensor Source tensor. Data types supported: U8/S8/QASYMM8/U16/S16/F16/U32/S32/F32 - * @param[in] constant_value Constant value to use to fill tensor. + * Valid data type configurations: + * |src |dst | + * |:--------------|:--------------| + * |All |All | + * + * @param[in,out] tensor Input tensor to fill. Supported data types: All. + * @param[in] constant_value The value used to fill the planes of the tensor + * @param[in] window Window to be used in case setting only part of a tensor. Default is nullptr. */ - void configure(ICLTensor *tensor, PixelValue constant_value); - /** Initialize the function + void configure(ICLTensor *tensor, const PixelValue &constant_value, Window *window = nullptr); + /** Initialise the kernel's tensor and filling value * * @param[in] compile_context The compile context to be used. - * @param[in,out] tensor Source tensor. Data types supported: U8/S8/QASYMM8/U16/S16/F16/U32/S32/F32 - * @param[in] constant_value Constant value to use to fill tensor. + * @param[in,out] tensor Input tensor to fill. Supported data types: All. + * @param[in] constant_value The value used to fill the planes of the tensor + * @param[in] window Window to be used in case setting only part of a tensor. Default is nullptr. + */ + void configure(const CLCompileContext &compile_context, + ICLTensor *tensor, + const PixelValue &constant_value, + Window *window = nullptr); + /** Static function to check if given info will lead to a valid configuration of @ref CLFill + * + * @param[in] tensor Source tensor info. Data types supported: All. + * @param[in] constant_value The value used to fill the planes of the tensor + * @param[in] window Window to be used in case setting only part of a tensor. Default is nullptr. + * + * @return a status */ - void configure(const CLCompileContext &compile_context, ICLTensor *tensor, PixelValue constant_value); + static Status validate(const ITensorInfo *tensor, const PixelValue &constant_value, Window *window = nullptr); + + // Inherited methods overridden: + void run() override; + +private: + struct Impl; + std::unique_ptr<Impl> _impl; }; } // namespace arm_compute #endif /*ARM_COMPUTE_CLFILL_H */ |