diff options
Diffstat (limited to 'compute/ARMComputeEx/arm_compute/runtime/CL/functions')
17 files changed, 0 insertions, 2005 deletions
diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLArgMinMaxLayerEx.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLArgMinMaxLayerEx.h deleted file mode 100644 index b1ee52bf9..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLArgMinMaxLayerEx.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2018-2019 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef __ARM_COMPUTE_CLARGMINMAXLAYEREX_H__ -#define __ARM_COMPUTE_CLARGMINMAXLAYEREX_H__ - -#include "arm_compute/core/CL/kernels/CLArgMinMaxLayerKernelEx.h" -#include "arm_compute/core/CL/kernels/CLReshapeLayerKernel.h" -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/IFunction.h" -#include "arm_compute/runtime/IMemoryManager.h" -#include "arm_compute/runtime/MemoryGroup.h" - -namespace arm_compute -{ -class ITensorInfo; -class ICLTensor; - -/** Function to calculate the index of the minimum or maximum values in a - * tensor based on an axis. - * - * @note The default data type for an uninitialized output tensor is - * signed 32-bit integer (S32). It is the user's responsibility to check - * that the results do not overflow because the indices are computed - * in unsigned 32-bit (U32). - */ -class CLArgMinMaxLayerEx : public IFunction -{ -public: - /** Default Constructor. - * - * @param[in] memory_manager (Optional) Memory manager. - */ - CLArgMinMaxLayerEx(std::shared_ptr<IMemoryManager> memory_manager = nullptr); - /** Set the input and output tensors. - * - * @param[in] input Input source tensor. Data types supported: QASYMM8/F16/F32. - * @param[in] axis Axis to find max/min index. - * @param[out] output Output source tensor. Data types supported: U32/S32. - * @param[in] op Reduction operation to perform. Operations supported: ARG_IDX_MAX, - * ARG_IDX_MIN - */ - void configure(const ICLTensor *input, int axis, ICLTensor *output, const ReductionOperation &op); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLArgMinMaxLayerEx - * - * @param[in] input Input source tensor info. Data types supported: QASYMM8/F16/F32. - * @param[in] axis Axis to find max/min index. - * @param[in] output Output source tensor info. Data types supported: U32/S32. - * @param[in] op Reduction operation to perform. Operations supported: ARG_IDX_MAX, - * ARG_IDX_MIN - * - * @return a status - */ - static Status validate(const ITensorInfo *input, int axis, const ITensorInfo *output, - const ReductionOperation &op); - - // Inherited methods overridden: - void run() override; - -private: - MemoryGroup _memory_group; - std::vector<CLTensor> _results_vector; - CLTensor _not_reshaped_output; - std::vector<CLArgMinMaxLayerKernelEx> _reduction_kernels_vector; - CLReshapeLayerKernel _reshape_kernel; - unsigned int _num_of_stages; - unsigned int _reduction_axis; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_CLARGMINMAXLAYEREX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLBinaryLogicalOp.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLBinaryLogicalOp.h deleted file mode 100644 index 88a9b00ec..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLBinaryLogicalOp.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2016-2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __ARM_COMPUTE_CLBINARYLOGICALOP_H__ -#define __ARM_COMPUTE_CLBINARYLOGICALOP_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" -#include "arm_compute/core/TypesEx.h" - -namespace arm_compute -{ -class ICLTensor; - -class CLBinaryLogicalOp : public ICLSimpleFunction -{ -public: - /** Initialise the function's source and destination. - * - * @param[in] input1 Source tensor1. Data types supported: U8, QASYMM8. - * @param[in] input2 Source tensor2. Data types supported: U8 QASYMM8. - * @param[out] output Output tensor. Data types supported: U8, QASYMM8. - */ - void configure(ICLTensor *input1, ICLTensor *input2, ICLTensor *output, - BinaryLogicalOperation op); -}; - -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLBINARYLOGICALOP_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLCastBool.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLCastBool.h deleted file mode 100644 index d6150684a..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLCastBool.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2016-2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/** - * @file CLCastBool.h - * @ingroup COM_AI_RUNTIME - * @brief This file contains arm_compute::CLCastBool class - */ - -#ifndef ARM_COMPUTE_CLCASTBOOL_H -#define ARM_COMPUTE_CLCASTBOOL_H - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to run @ref CLCastBoolKernel. - * This converts the boolean input tensor to the output tensor's type. - */ -class CLCastBool : public ICLSimpleFunction -{ -public: - /** - * @brief Initialise the kernel's input and output - * @param[in] input Input tensor. Data types supported: U8 - * @param[out] output Output tensor. Data types supported: U8/S8/U16/S16/U32/F16/F32. - */ - void configure(ICLTensor *input, ICLTensor *output); -}; -} -#endif /* ARM_COMPUTE_CLCASTBOOL_H */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLDirectTransposeConvLayer.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLDirectTransposeConvLayer.h deleted file mode 100644 index 409eaf593..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLDirectTransposeConvLayer.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2019-2020 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef __ARM_COMPUTE_CLDIRECTTRANSPOSECONVLAYER_H__ -#define __ARM_COMPUTE_CLDIRECTTRANSPOSECONVLAYER_H__ - -#include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h" -#include "arm_compute/runtime/CL/functions/CLDeconvolutionLayerUpsample.h" -#include "arm_compute/runtime/CL/functions/CLReverse.h" -#include "arm_compute/runtime/CL/functions/CLTranspose.h" - -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/IFunction.h" -#include "arm_compute/runtime/IMemoryManager.h" -#include "arm_compute/runtime/MemoryGroup.h" - -#include <memory> - -namespace arm_compute -{ -class ICLTensor; -/** Function to run the deconvolution layer. - * - * Deconvolution Layer is the backward pass of Convolution Layer. First we transform the input - * depending on the stride and pad info and then perform a 1x1 - * convolution pass. Input stride defines how many zeroes we should put between each element of the - * input and pad is the amount of padding. - * - * The relation between input to output is as follows: - * \f[ - * width\_output = (width\_input - 1) \cdot stride\_x - 2 \cdot padding\_x + kernel\_x - * \f] - * \f[ - * height\_output = (height\_input - 1) \cdot stride\_y - 2 \cdot padding\_y + kernel\_y - * \f] - * - * where: - * width_input is the size of the first input dimension. - * height_input is the size of the second input dimension. - * width_output is the size of the first output dimension. - * height_output is the size of the second output dimension. - * kernel_x and kernel_y are the convolution sizes in x and y. - * stride_x and stride_y is the input stride of the first and second dimension. - * - * The weights used by Deconvolution are supposed to be the same as the ones used for Convolution. - * Therefore, it will be necessary to use the weights in the - * reverse order to perform an actual convolution. This is achieved by using @ref CLReverse. - * - * This function calls the following OpenCL kernels/functions: - * - * -# @ref CLDeconvolutionLayerUpsample - * -# @ref CLConvolutionLayer - * - * And the following CPP kernels: - * -# @ref CLReverse - * - */ -class CLDirectTransposeConvLayer : public IFunction -{ -public: - /** Constructor */ - CLDirectTransposeConvLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLDirectTransposeConvLayer(const CLDirectTransposeConvLayer &) = delete; - /** Default move constructor */ - CLDirectTransposeConvLayer(CLDirectTransposeConvLayer &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLDirectTransposeConvLayer &operator=(const CLDirectTransposeConvLayer &) = delete; - /** Default move assignment operator */ - CLDirectTransposeConvLayer &operator=(CLDirectTransposeConvLayer &&) = default; - /** Set the input, weights, biases and output tensors. - * - * @param[in,out] input Input tensor. 3 lower dimensions represent a single input, and an - * optional 4th dimension for batch of inputs. - * Data types supported: QASYMM8_SIGNED/QASYMM8/F16/F32. - * @param[in] weights The 4d weights with dimensions [width, height, IFM, OFM]. Data type - * supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. - * Data type supported: Should match @p input data type, except for - * input of QASYMM8 and QASYMM8_SIGNED type where biases should be of S32 type - * @param[out] output Output tensor. The output has the same number of dimensions as the - * @p input. - * @param[in] info Contains padding and policies to be used in the deconvolution, this - * is decribed in @ref PadStrideInfo. - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * @param[in] weights_info (Optional) Weights information needed for @ref CLConvolutionLayer, - * specifies if the weights tensor has been reshaped with @ref CLWeightsReshapeKernel. - * - */ - void configure(ICLTensor *input, ICLTensor *weights, const ICLTensor *bias, ICLTensor *output, - const PadStrideInfo &info, unsigned int invalid_right, unsigned int invalid_bottom, - const WeightsInfo &weights_info = WeightsInfo()); - /** Set the input, weights, biases and output tensors. - * - * @param[in] compile_context The compile context to be used. - * @param[in,out] input Input tensor. 3 lower dimensions represent a single input, and - * an optional 4th dimension for batch of inputs. - * Data types supported: QASYMM8_SIGNED/QASYMM8/F16/F32. - * @param[in] weights The 4d weights with dimensions [width, height, IFM, OFM]. Data - * type supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. - * Data type supported: Should match @p input data type, except for - * input of QASYMM8 and QASYMM8_SIGNED type where biases should be of S32 type - * @param[out] output Output tensor. The output has the same number of dimensions as - * the @p input. - * @param[in] info Contains padding and policies to be used in the deconvolution, - * this is decribed in @ref PadStrideInfo. - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * @param[in] weights_info (Optional) Weights information needed for @ref - * CLConvolutionLayer, specifies if the weights tensor has been reshaped with @ref - * CLWeightsReshapeKernel. - * - */ - void configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *weights, - const ICLTensor *bias, ICLTensor *output, const PadStrideInfo &info, - unsigned int invalid_right, unsigned int invalid_bottom, - const WeightsInfo &weights_info = WeightsInfo()); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLDirectTransposeConvLayer - * - * @param[in] input Input tensor info. 3 lower dimensions represent a single input, and an - * optional 4th dimension for batch of inputs. - * Data types supported: QASYMM8_SIGNED/QASYMM8/F16/F32. - * @param[in] weights The 4d weights info with dimensions [width, height, IFM, OFM]. Data - * type supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. - * Data type supported: Should match @p input data type, except for input - * of QASYMM8 and QASYMM8_SIGNED type where biases should be of S32 type - * @param[in] output Output tensor info. The output has the same number of dimensions as the - * @p input. - * @param[in] info Contains padding and policies to be used in the deconvolution, this is - * decribed in @ref PadStrideInfo. - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * @param[in] weights_info (Optional) Weights information needed for @ref CLConvolutionLayer, - * specifies if the weights tensor has been reshaped with @ref CLWeightsReshapeKernel. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *weights, - const ITensorInfo *bias, ITensorInfo *output, const PadStrideInfo &info, - unsigned int invalid_right, unsigned int invalid_bottom, - const WeightsInfo &weights_info = WeightsInfo()); - - // Inherited methods overridden: - void run() override; - void prepare() override; - -private: - MemoryGroup _memory_group; - CLDeconvolutionLayerUpsample _scale_f; - CLConvolutionLayer _conv_f; - CLReverse _flip_weights; - - CLTensor _scaled_output; - ICLTensor *_original_weights; - CLTensor _weights_flipped; - CLTensor _flip_axis; - - bool _is_prepared; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_CLDIRECTTRANSPOSECONVLAYER_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLEmbeddingLookup.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLEmbeddingLookup.h deleted file mode 100644 index fbee7e40e..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLEmbeddingLookup.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2016-2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/** - * @file CLEmbeddingLookup.h - * @ingroup COM_AI_RUNTIME - * @brief This file contains arm_compute::CLEmbeddingLookup class - */ - -#ifndef __ARM_COMPUTE_CLEMBEDDINGLOOKUP_H__ -#define __ARM_COMPUTE_CLEMBEDDINGLOOKUP_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -#include <vector> - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to perform EmbeddingLookup operation - */ -class CLEmbeddingLookup : public ICLSimpleFunction -{ -public: - /** - * @brief Set the input and output tensors. - * @param[in] input Source tensor. - * Data types supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[out] output Destination tensor. Data types and data layouts supported: Same as @p - * input. - * @param[in] lookups Lookups 1D tensor that values are indices into the first dimension of - * input. - * @return N/A - */ - void configure(const ICLTensor *input, ICLTensor *output, const ICLTensor *lookups); -}; -} -#endif /*__ARM_COMPUTE_CLEMBEDDINGLOOKUP_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedHybridLayer.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedHybridLayer.h deleted file mode 100644 index f3266f688..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedHybridLayer.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2017-2019 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __ARM_COMPUTE_CLFULLYCONNECTEDHYBRIDLAYER_H__ -#define __ARM_COMPUTE_CLFULLYCONNECTEDHYBRIDLAYER_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -#include "arm_compute/core/CL/kernels/CLGEMMMatrixAccumulateBiasesKernel.h" -#include "arm_compute/core/CL/kernels/CLMultiplyScaleFactorKernel.h" -#include "arm_compute/core/CL/kernels/CLQuantizationSymmetricKernel.h" -#include "arm_compute/core/CL/kernels/CLScaleFactorSymm8Kernel.h" -#include "arm_compute/core/CL/kernels/CLTransposeKernel.h" -#include "arm_compute/runtime/MemoryGroup.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.h" - -namespace arm_compute -{ -/** Basic function to reshape the weights of Fully Connected layer with OpenCL. This function calls - * the following kernels: - * - * -# @ref CLTransposeKernel - * - * @note The fully connected layer accepts "weights" tensors only with 2 dimensions. - */ -class CLFullyConnectedHybridLayerReshapeWeights : public ICLSimpleFunction -{ -public: - /** Set the input and output tensors. - * - * @param[in] input Weights tensor. The weights must be 2 dimensional. Data types supported: - * S8. - * @param[out] output Destination tensor which stores the transposed input tensor. Data type - * supported: Same as @p input. - */ - void configure(const ICLTensor *input, ICLTensor *output); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLFullyConnectedHybridLayerReshapeWeights - * - * @param[in] input Weights tensor. The weights must be 2 dimensional. Data types supported: - * S8. - * @param[in] output Destination tensor which stores the transposed input tensor. Data type - * supported: Same as @p input. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output); -}; - -/** Basic function to compute a Fully Connected layer on OpenCL. This function calls the following - * OpenCL kernels: - * - * -# @ref CLIm2ColKernel (called when the input comes from a convolutional layer) - * -# @ref CLFullyConnectedHybridLayerReshapeWeights (if @p are_weights_reshaped is set to false - * and transpose_weights is set to true ) (called once) - * -# @ref CLGEMMLowpMatrixMultiplyCore (if quantized symmetric) - * -# @ref CLGEMMMatrixAccumulateBiasesKernel (if @p biases is not equal to nullptr) - * - * @note The fully connected layer accepts "weights" tensors only with 2 dimensions. - */ -class CLFullyConnectedHybridLayer : public IFunction -{ -public: - /** Constructor */ - CLFullyConnectedHybridLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLFullyConnectedHybridLayer(const CLFullyConnectedHybridLayer &) = delete; - /** Default move constructor */ - CLFullyConnectedHybridLayer(CLFullyConnectedHybridLayer &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLFullyConnectedHybridLayer &operator=(const CLFullyConnectedHybridLayer &) = delete; - /** Default move assignment operator */ - CLFullyConnectedHybridLayer &operator=(CLFullyConnectedHybridLayer &&) = default; - /** Set the input and output tensors. - * - * @param[in] input Source tensor. Data type supported: F16/F32. - * @param[in] weights Weights tensor. The weights must be 2 dimensional. - * If this function is called after a Convolution Layer, the (transposed) - * weights will have as many rows as the product of the first 3 input's dimensions. - * If it is called after another FullyConnected Layer, the (transposed) - * weights will have as many rows as the input's first dimension. - * Data type supported: S8. - * @param[in] biases Bias tensor. Can be nullptr. Data type supported:Same as @p input. - * @param[out] output Destination tensor. Its shape should be equal to the output of a matrix - * multiplication between: - * - The output of im2col on the input and the (transposed) 2D weights, if the - * function is called after a Convolution Layer - * - The input tensor and the (transposed) 2D weights, if the function is - * called after another FullyConnected Layer. - * Data type supported: Same as @p input. - * @param[in] fc_info (Optional) Fully connected layer additional info - */ - void configure(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, - ICLTensor *output, FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo()); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLFullyConnectedHybridLayer - * - * @param[in] input Source tensor info. Data type supported: F16/F32. - * @param[in] weights Weights tensor info. The weights must be 2 dimensional. - * If this function is called after a Convolution Layer, the (transposed) - * weights will have as many rows as the product of the first 3 input's dimensions. - * If it is called after another FullyConnected Layer, the (transposed) - * weights will have as many rows as the input's first dimension. - * Data type supported: S8. - * @param[in] biases Bias tensor info. Can be nullptr. Data type supported:Same as @p input. - * @param[out] output Destination tensor info. Its shape should be equal to the output of a - * matrix multiplication between: - * - The output of im2col on the input and the (transposed) 2D weights, if the - * function is called after a Convolution Layer - * - The input tensor and the (transposed) 2D weights, if the function is - * called after another FullyConnected Layer. - * Data type supported: Same as @p input. - * @param[in] fc_info (Optional) Fully connected layer additional info - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *weights, - const ITensorInfo *biases, const ITensorInfo *output, - FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo()); - - // Inherited methods override - void run() override; - void prepare() override; - -private: - void configure_mm(const ICLTensor *input, const ICLTensor *weights, ICLTensor *output, - bool retain_internal_weights); - - MemoryGroup _memory_group; - CLFullyConnectedHybridLayerReshapeWeights _reshape_weights_kernel; - CLScaleFactorSymm8Kernel _scale_factor_kernel; - CLQuantizationSymmetricKernel _quant_input_kernel; - CLGEMMLowpMatrixMultiplyCore _mm_gemmlowp; - CLMultiplyScaleFactorKernel _multiply_scale_kernel; - CLGEMMMatrixAccumulateBiasesKernel _accumulate_biases_kernel; // TODO(COMPMID-1889): Use CLGEMM to - // add bias in - // CLFullyConnectedHybridLayer - CLTensor _reshape_weights_output; - CLTensor _quantized_input; - CLTensor _scale_factor; - CLTensor _gemmlowp_output; - bool _are_weights_reshaped; - bool _accumulate_biases; - bool _is_prepared; - const ICLTensor *_original_weights; -}; -} -#endif /* __ARM_COMPUTE_CLFULLYCONNECTEDHYBRIDLAYER_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedLayerEx.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedLayerEx.h deleted file mode 100644 index e65a646dc..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedLayerEx.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2017-2019 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __ARM_COMPUTE_CLFULLYCONNECTEDLAYEREX_H__ -#define __ARM_COMPUTE_CLFULLYCONNECTEDLAYEREX_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -#include "arm_compute/core/CL/kernels/CLGEMMMatrixAccumulateBiasesKernel.h" -#include "arm_compute/core/CL/kernels/CLTransposeKernel.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/functions/CLConvertFullyConnectedWeights.h" -#include "arm_compute/runtime/CL/functions/CLFlattenLayer.h" -#include "arm_compute/runtime/CL/functions/CLGEMM.h" -#include "arm_compute/runtime/CL/functions/CLGEMMLowpMatrixMultiplyCore.h" -#include "arm_compute/runtime/CL/functions/CLGEMMLowpOutputStage.h" -#include "arm_compute/runtime/IWeightsManager.h" -#include "arm_compute/runtime/MemoryGroup.h" - -namespace arm_compute -{ -/** Basic function to reshape the weights of Fully Connected layer with OpenCL. This function calls - * the following kernels: - * - * -# @ref CLTransposeKernel - * - * @note The fully connected layer accepts "weights" tensors only with 2 dimensions. - */ -class CLFullyConnectedLayerReshapeWeightsEx : public ICLSimpleFunction -{ -public: - /** Set the input and output tensors. - * - * @param[in] input Weights tensor. The weights must be 2 dimensional. Data types supported: - * QASYMM8/F16/F32. - * @param[out] output Destination tensor which stores the transposed input tensor. Data type - * supported: Same as @p input. - */ - void configure(const ICLTensor *input, ICLTensor *output); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLFullyConnectedLayerReshapeWeightsEx - * - * @param[in] input Weights tensor. The weights must be 2 dimensional. Data types supported: - * QASYMM8/F16/F32. - * @param[in] output Destination tensor which stores the transposed input tensor. Data type - * supported: Same as @p input. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output); -}; - -namespace weights_transformations -{ -/** Basic function to manage the reshape weights generated from @ref - * CLFullyConnectedLayerReshapeWeightsEx */ -class CLFullyConnectedLayerReshapeWeightsExManaged : public ITransformWeights -{ -public: - // Inherited method override - void run() override - { - _output.allocator()->allocate(); - _func.run(); - _reshape_run = true; - } - - // Inherited method override - void release() override { _output.allocator()->free(); } - - // Inherited method override - ICLTensor *get_weights() override { return &_output; } - - // Inherited method override - uint32_t uid() override { return _uid; } - - /** Configures the @ref CLFullyConnectedLayerReshapeWeightsEx function - * - * @param[in] input Source tensor. Data type supported: QASYMM8/F16/F32. - */ - void configure(const ICLTensor *input) { _func.configure(input, &_output); } - -private: - static constexpr uint32_t _uid = 0x0; - CLTensor _output{}; - CLFullyConnectedLayerReshapeWeightsEx _func{}; -}; -} // namespace weights_transformations - -/** Basic function to compute a Fully Connected layer on OpenCL. This function calls the following - * OpenCL kernels: - * - * -# @ref CLIm2ColKernel (called when the input comes from a convolutional layer) - * -# @ref CLFullyConnectedLayerReshapeWeightsEx (if @p are_weights_reshaped is set to false and - * transpose_weights is set to true ) (called once) - * -# @ref CLGEMMMatrixMultiplyKernel or @ref CLGEMMLowpMatrixMultiplyCore (if quantized - * asymmetric) - * -# @ref CLGEMMMatrixAccumulateBiasesKernel or @ref - * CLGEMMLowpQuantizeDownInt32ToUint8ScaleByFixedPoint (if quantized asymmetric) (if @p biases is - * not equal to nullptr) - * - * @note The fully connected layer accepts "weights" tensors only with 2 dimensions. - */ -class CLFullyConnectedLayerEx : public IFunction -{ -public: - /** Constructor */ - CLFullyConnectedLayerEx(std::shared_ptr<IMemoryManager> memory_manager = nullptr, - IWeightsManager *weights_manager = nullptr); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLFullyConnectedLayerEx(const CLFullyConnectedLayerEx &) = delete; - /** Default move constructor */ - CLFullyConnectedLayerEx(CLFullyConnectedLayerEx &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLFullyConnectedLayerEx &operator=(const CLFullyConnectedLayerEx &) = delete; - /** Default move assignment operator */ - CLFullyConnectedLayerEx &operator=(CLFullyConnectedLayerEx &&) = default; - /** Set the input and output tensors. - * - * @param[in] input Source tensor. Data type supported: QASYMM8/F16/F32. - * @param[in] weights Weights tensor. The weights must be 2 dimensional. - * If this function is called after a Convolution Layer, the (transposed) - * weights will have as many rows as the product of the first 3 input's dimensions. - * If it is called after another FullyConnected Layer, the (transposed) - * weights will have as many rows as the input's first dimension. - * Data type supported: Same as @p input. - * @param[in] biases Bias tensor. Can be nullptr. Data type supported:Same as @p input. - * @param[out] output Destination tensor. Its shape should be equal to the output of a matrix - * multiplication between: - * - The output of im2col on the input and the (transposed) 2D weights, if the - * function is called after a Convolution Layer - * - The input tensor and the (transposed) 2D weights, if the function is - * called after another FullyConnected Layer. - * Data type supported: Same as @p input. - * @param[in] fc_info (Optional) Fully connected layer additional info - */ - void configure(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, - ICLTensor *output, FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo()); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLFullyConnectedLayerEx - * - * @param[in] input Source tensor info. Data type supported: QASYMM8/F16/F32. - * @param[in] weights Weights tensor info. The weights must be 2 dimensional. - * If this function is called after a Convolution Layer, the (transposed) - * weights will have as many rows as the product of the first 3 input's dimensions. - * If it is called after another FullyConnected Layer, the (transposed) - * weights will have as many rows as the input's first dimension. - * Data type supported: Same as @p input. - * @param[in] biases Bias tensor info. Can be nullptr. Data type supported:Same as @p input. - * @param[out] output Destination tensor info. Its shape should be equal to the output of a - * matrix multiplication between: - * - The output of im2col on the input and the (transposed) 2D weights, if the - * function is called after a Convolution Layer - * - The input tensor and the (transposed) 2D weights, if the function is - * called after another FullyConnected Layer. - * Data type supported: Same as @p input. - * @param[in] fc_info (Optional) Fully connected layer additional info - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *weights, - const ITensorInfo *biases, const ITensorInfo *output, - FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo()); - - // Inherited methods override - void run() override; - void prepare() override; - -private: - void configure_fc_fc(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *bias, - ICLTensor *output, const FullyConnectedLayerInfo &fc_info); - void configure_conv_fc(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *bias, - ICLTensor *output, const FullyConnectedLayerInfo &fc_info); - void configure_mm(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *bias, - ICLTensor *output, const FullyConnectedLayerInfo &fc_info); - - MemoryGroup _memory_group; - IWeightsManager *_weights_manager; - CLConvertFullyConnectedWeights _convert_weights; - weights_transformations::CLConvertFullyConnectedWeightsManaged _convert_weights_managed; - weights_transformations::CLFullyConnectedLayerReshapeWeightsExManaged - _reshape_weights_managed_function; - CLFlattenLayer _flatten_layer; - CLFullyConnectedLayerReshapeWeightsEx _reshape_weights_function; - CLGEMM _mm_gemm; - CLGEMMLowpMatrixMultiplyCore _mm_gemmlowp; - CLTensor _flatten_output; - CLTensor _converted_weights_output; - CLTensor _reshape_weights_output; - bool _are_weights_converted; - bool _are_weights_reshaped; - bool _is_fc_after_conv; - bool _is_quantized; - bool _is_prepared; - const ICLTensor *_original_weights; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_CLFULLYCONNECTEDLAYEREX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedReshapingLayer.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedReshapingLayer.h deleted file mode 100644 index 289ab167f..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLFullyConnectedReshapingLayer.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file       CLFullyConnectedReshapingLayer.h - * @brief      This file contains CLFullyConnectedReshapingLayer class - * @ingroup    COM_AI_RUNTIME - */ - -#ifndef __ARM_COMPUTE_CL_FULLY_CONNECTED_RESHAPING_LAYER_H__ -#define __ARM_COMPUTE_CL_FULLY_CONNECTED_RESHAPING_LAYER_H__ - -#include <arm_compute/runtime/CL/CLTensor.h> -#include <arm_compute/runtime/CL/functions/CLReshapeLayer.h> -#include <arm_compute/runtime/IMemoryManager.h> - -namespace arm_compute -{ -/** - * @brief Class to run FullyConnected Layer after reshaping input tensor - */ -class CLFullyConnectedReshapingLayer : public arm_compute::IFunction -{ -public: - enum class KernelType - { - GENERAL, //< General FC - PREPROCESSED_WEIGHTS //< Weights are constants so it can be preprocessed - }; - -public: - CLFullyConnectedReshapingLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr) - : _input(nullptr), _weights(nullptr), _biases(nullptr), _output(nullptr), _cl_buffer{}, - _memory_manager{memory_manager}, _cl_fc{nullptr}, _cl_reshape{}, _needs_reshape(false) - { - // DO NOTHING - } - -public: - /** - * @brief Configure the layer - * @param[in] input The source tensor - * @param[in] weights The tensor that is filled with weight values - * @param[in] biases The tensor that is filled with biase values - * @param[in] output The destination tensor - * @param[in] needs_reshape Whether it needs to be reshaped or not - * @param[in] reshape The tensor shape to be reshaped. Only valid when needs_reshape is true. - * @return N/A - */ - void configure(const arm_compute::ICLTensor *input, const arm_compute::ICLTensor *weights, - const arm_compute::ICLTensor *biases, arm_compute::ICLTensor *output, - bool needs_reshape, const arm_compute::TensorShape &reshape, - KernelType kernel_type); - -public: - /** - * @brief Run the operation. Must be called after configure(). - * @return N/A - */ - void run(void) override; - /** - * @brief Prepare the operation - * @return N/A - */ - void prepare(void) override; - -private: - const arm_compute::ICLTensor *_input; - const arm_compute::ICLTensor *_weights; - const arm_compute::ICLTensor *_biases; - arm_compute::ICLTensor *_output; - - // buffer for reshaping input tensor - arm_compute::CLTensor _cl_buffer; - -private: - std::shared_ptr<IMemoryManager> _memory_manager; - std::unique_ptr<arm_compute::IFunction> _cl_fc; - CLReshapeLayer _cl_reshape; - bool _needs_reshape; -}; -} // namespace arm_compute - -#endif // __ARM_COMPUTE_CL_FULLY_CONNECTED_RESHAPING_LAYER_H__ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLGatherEx.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLGatherEx.h deleted file mode 100644 index b01ec4255..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLGatherEx.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2016-2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/** - * @file CLGatherEx.h - * @brief This file contains CLGatherEx class - * @ingroup COM_AI_RUNTIME - */ - -#ifndef __ARM_COMPUTE_CLGATHEREX_H__ -#define __ARM_COMPUTE_CLGATHEREX_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to to run @ref CLGatherKernel. - */ -class CLGatherEx : public ICLSimpleFunction -{ -public: - /** - * @brief Initialise the kernel's inputs, output and convertion policy. - * @param[in] input An input tensor. Data types supported: U8/QASYMM8/S32/F32. - * @param[in] indices An indexes tensor. Data types supported: S32. - * @param[out] output The output tensor, Data types supported: same as @p input. - * @param[in] axis (Optional) The axis in @p input to gather @p indices from. Defaults to 0 - * @return N/A - */ - void configure(const ICLTensor *input, const ICLTensor *indices, ICLTensor *output, int axis = 0); - - /** - * @brief Static function to check if given info will lead to a valid configuration - * of @ref CLGatherEx - * @param[in] input An input tensor. Data types supported: U8/QASYMM8/S32/F32. - * @param[in] indices An indexes tensor. Data types supported: S32. - * @param[out] output The output tensor, Data types supported: same as @p input. - * @param[in] axis (Optional) The axis in @p input to gather @p indices from. Defaults to 0 - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *indices, - const ITensorInfo *output, int axis = 0); -}; -} -#endif /*__ARM_COMPUTE_CLGATHEREX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLHashtableLookup.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLHashtableLookup.h deleted file mode 100644 index 6618f5aa4..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLHashtableLookup.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2016-2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/** - * @file CLHashtableLookup.h - * @ingroup COM_AI_RUNTIME - * @brief This file contains arm_compute::CLHashtableLookup class - */ - -#ifndef __ARM_COMPUTE_CLHASHTABLELOOKUP_H__ -#define __ARM_COMPUTE_CLHASHTABLELOOKUP_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -#include <vector> - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to perform HashtableLookup operation - */ -class CLHashtableLookup : public ICLSimpleFunction -{ -public: - /** - * @brief Set the input and output tensors. - * @param[in] lookups Lookups 1D tensor that values are indices into the first dimension of - * input. - * @param[in] keys Keys 1D tensor. keys and input pair represent a map. - * Data types supported: S32 - * @param[in] input Source tensor. - * Data types supported: U8/S8/QASYMM8/U16/S16/U32/S32/F16/F32 - * @param[out] output Destination tensor. Data types and data layouts supported: Same as @p - * input. - * @param[out] hits Hits 1D tensor. A boolean tensor that indicates whether the lookup hits - * (True) or not (False). Data types supported: U8/QASYMM8 - * @return N/A - */ - void configure(const ICLTensor *lookups, const ICLTensor *keys, const ICLTensor *intput, - ICLTensor *output, ICLTensor *hits); -}; -} -#endif /*__ARM_COMPUTE_CLHASHTABLELOOKUP_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLInstanceNormalizationLayerEx.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLInstanceNormalizationLayerEx.h deleted file mode 100644 index 887e7aaa5..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLInstanceNormalizationLayerEx.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2019 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __ARM_COMPUTE_CLINSTANCENORMALIZATIONLAYEREX_H__ -#define __ARM_COMPUTE_CLINSTANCENORMALIZATIONLAYEREX_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -namespace arm_compute -{ -class ICLTensor; - -/** Basic function to perform a Instance normalization. - * - * This function runs the following kernels: - * -# @ref CLInstanceNormalizationLayerKernelEx - */ -class CLInstanceNormalizationLayerEx : public ICLSimpleFunction -{ -public: - /** Default constructor */ - CLInstanceNormalizationLayerEx(); - /** Set the input and output tensors. - * - * @param[in, out] input Source tensor. In case of @p output tensor = nullptr this tensor will - * store the result of the normalization. - * Data types supported: F16/F32. Data layout supported: NHWC, NCHW - * @param[out] output Destination tensor. Data types and data layouts supported: same as @p - * input. - * @param[in] gamma (Optional) The scale tensor applied to the normalized tensor. Defaults - * to nullptr - * @param[in] beta (Optional) The offset tensor applied to the normalized tensor. Defaults - * to nullptr - * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12 - */ - void configure(ICLTensor *input, ICLTensor *output, ICLTensor *gamma = nullptr, - ICLTensor *beta = nullptr, float epsilon = 1e-12f); - - /** Static function to check if given info will lead to a valid configuration of @ref - * CLInstanceNormalizationLayerEx. - * - * @param[in] input Source tensor info. Data types supported: F16/F32. Data layout supported: - * NHWC, NCHW - * @param[in] output Destination tensor info. Data types and data layouts supported: same as @p - * input. - * @param[in] gamma (Optional) The scale tensor applied to the normalized tensor. Defaults to - * nullptr - * @param[in] beta (Optional) The offset tensor applied to the normalized tensor. Defaults to - * nullptr - * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12 - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, - const ITensorInfo *gamma = nullptr, const ITensorInfo *beta = nullptr, - float epsilon = 1e-12f); -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_CLINSTANCENORMALIZATIONLAYEREX_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLNeg.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLNeg.h deleted file mode 100644 index 8ec9aa307..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLNeg.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2016-2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __ARM_COMPUTE_CLNEG_H__ -#define __ARM_COMPUTE_CLNEG_H__ - -#include "arm_compute/runtime/CL/ICLSimpleFunction.h" - -namespace arm_compute -{ -class ICLTensor; - -class CLNeg : public ICLSimpleFunction -{ -public: - /** Initialise the function's source and destination. - * - * @param[in] input Source tensor. Data types supported: - * U8/S8/QASYMM8/U16/S16/F16/U32/S32/F32. - * @param[out] output Output tensor. Data types supported: Same as @p input. - * - */ - void configure(ICLTensor *input, ICLTensor *output); -}; -} // namespace arm_compute -#endif /*__ARM_COMPUTE_CLNEG_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLOneHot.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLOneHot.h deleted file mode 100644 index 2bbfca821..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLOneHot.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2018-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef __ARM_COMPUTE_CLONEHOT_H__ -#define __ARM_COMPUTE_CLONEHOT_H__ -#include "arm_compute/core/CL/kernels/CLMemsetKernel.h" -#include "arm_compute/core/CL/kernels/CLOneHotKernel.h" -#include "arm_compute/runtime/IFunction.h" -namespace arm_compute -{ -class ICLTensor; -/** Basic function to run @ref CLOneHotKernel */ -class CLOneHot : public IFunction -{ -public: - /** Constructor */ - CLOneHot(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLOneHot(const CLOneHot &) = delete; - /** Default move constructor */ - CLOneHot(CLOneHot &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - CLOneHot &operator=(const CLOneHot &) = delete; - /** Default move assignment operator */ - CLOneHot &operator=(CLOneHot &&) = default; - /** Initialise the kernel's inputs and outputs - * - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] on_value On value tensor. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[in] off_value Off value tensor. Supported tensor rank: only 1. Data type supported: - * Same as @p on_value - * @param[out] output Destination tensor. Data type supported: Same as @p on_value - * @param[in] depth The depth of the one hot dimension. - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * value must be in range [-indices.rank , indices.rank) - */ - void configure(const ICLTensor *indices, const ICLTensor *on_value, const ICLTensor *off_value, - ICLTensor *output, int depth, int axis = -1); - /** Initialise the kernel's inputs and outputs with off_value being constant - * - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] on_value On value tensor. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[out] output Destination tensor. Data type supported: Same as @p on_value - * @param[in] off_value The PixelValue for off value. Data type supported: Same as @p on_value - * @param[in] depth The depth of the one hot dimension. - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * value must be in range [-indices.rank , indices.rank) - */ - void configure(const ICLTensor *indices, const ICLTensor *on_value, ICLTensor *output, - PixelValue off_value, int depth, int axis = -1); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLOneHotKernel - * - * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the - * following types: U32/S32 - * @param[in] on_value On value tensor. Supported tensor rank: only 1. Data type supported: - * U8/S8/U16/S16/F16/U32/S32/F32 - * @param[in] off_value Off value tensor. Supported tensor rank: only 1. Data type supported: - * Same as @p on_value - * @param[in] output Destination tensor. Data type supported: Same as @p on_value - * @param[in] depth The depth of the one hot dimension. - * @param[in] axis (Optional) The axis to fill. Negative values wrap around. Defaults to -1. - * value must be in range [-indices.rank , indices.rank) - * - * @return a status - */ - static Status validate(const ITensorInfo *indices, const ITensorInfo *on_value, - const ITensorInfo *off_value, const ITensorInfo *output, int depth, - int axis = -1); - - // Inherited methods overridden: - void run() override; - -private: - CLMemsetKernel _memset_kernel; /**< Memset kernel */ - CLOneHotKernel _onehot_kernel; /**< OneHot kernel */ - bool _has_to_memset; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_CLONEHOT_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLReduceOperation.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLReduceOperation.h deleted file mode 100644 index 7dba84b12..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLReduceOperation.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2016-2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/** - * @file CLReduceOperation.h - * @ingroup COM_AI_RUNTIME - * @brief This file contains arm_compute::CLReduceOperation class - */ - -#ifndef __ARM_COMPUTE_CLREDUCEOPERATION_H__ -#define __ARM_COMPUTE_CLREDUCEOPERATION_H__ - -#include "arm_compute/core/CL/kernels/CLReduceOperationKernel.h" -#include "arm_compute/core/TypesEx.h" -#include "arm_compute/runtime/MemoryGroup.h" -#include "arm_compute/runtime/CL/CLTensor.h" -#include "arm_compute/runtime/CL/CLTensorAllocator.h" -#include "arm_compute/runtime/CL/functions/CLReshapeLayer.h" -#include "arm_compute/runtime/IFunction.h" -#include "arm_compute/runtime/IMemoryManager.h" - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to perform ReduceOperation - */ -class CLReduceOperation : public IFunction -{ -public: - /** - * @brief Construct a new ReduceOperation object - */ - CLReduceOperation(std::shared_ptr<IMemoryManager> memory_manager); - - /** - * @brief Set the input and output tensors. - * @param[in] input Source tensor. Data types supported: U8/S32/F32 - * @param[out] output Destination tensor. Data types and data layouts supported: Same as @p - * input. - * @param[in] axis Axis along which to reduce. It must be sorted and no duplicates. - * @param[in] keep_dims If positive, retains reduced dimensions with length 1. - * @param[in] op Reduce operation to perform. - * @return N/A - */ - void configure(ICLTensor *input, ICLTensor *output, const std::set<uint32_t> &axis, - bool keep_dims, ReduceOperation op); - - /** - * @brief Static function to check if given info will lead to a valid configuration of @ref - * CLReduceOperation. - * @param[in] input Source tensor info. Data types supported: U8/S32/F32 - * @param[in] output Destination tensor info. Data types and data layouts supported: Same as @p - * input. - * @param[in] axis Axis along which to reduce. It must be sorted and no duplicates. - * @param[in] keep_dims If positive, retains reduced dimensions with length 1. - * @param[in] op Reduce operation to perform. - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output, - const std::set<uint32_t> &axis, bool keep_dims, const ReduceOperation &op); - - /** - * @brief Run the OpenCL kernel for this operation - * @return N/A - */ - void run() override; - -private: - MemoryGroup _memory_group; - ICLTensor *_input; - ICLTensor *_output; - std::set<uint32_t> _axis; - bool _keep_dims; - - std::unique_ptr<CLTensor[]> _interm_tensors{nullptr}; - std::unique_ptr<CLReduceOperationKernel[]> _reduce_kernels{nullptr}; - CLReshapeLayer _reshape; -}; -} -#endif /*__ARM_COMPUTE_CLREDUCEOPERATION_H__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLSplitVEx.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLSplitVEx.h deleted file mode 100644 index bb741d98d..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLSplitVEx.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2017-2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef __ARM_COMPUTE_CLSPLITVEX__ -#define __ARM_COMPUTE_CLSPLITVEX__ - -#include "arm_compute/runtime/IFunction.h" -#include "arm_compute/runtime/CL/functions/CLSlice.h" -#include "arm_compute/core/Types.h" -#include <vector> -#include <memory> - -namespace arm_compute -{ -class ICLTensor; - -/** Basic function to run @ref CLSplitVKernel */ -class CLSplitVEx : public IFunction -{ -public: - /** Default constructor */ - CLSplitVEx(); - /** Configure the split CL kernel - * - * @param[in] input The input tensor to split. Data types supported: - * U8/S8/QASYMM8/U16/S16/F16/U32/S32/F32 - * @param[in] size_splits A 1-D tensor containing the number of tensor values per split - * @param[out] outputs A vector containing the output tensor. Data types supported: Same as @p - * input - * The output tensors should match the input tensor dimensions for all - * shape dimensions apart - * from the split dimension. - * @param[in] split_dim Integer value representing the input tensor dimension along which to - * split - * @param[in] num_splits Number of splits - */ - void configure(const ICLTensor *input, const ICLTensor *size_splits, uint32_t split_dim, - const std::vector<ICLTensor *> &outputs, unsigned int num_splits); - - void run() override; - -private: - const ICLTensor *_input; - const ICLTensor *_size_splits; - std::vector<ICLTensor *> _outputs; - unsigned int _num_splits; - std::vector<CLSlice> _slice_functions; -}; -} -#endif /* __ARM_COMPUTE_CLSPLITVEX__ */ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLTopKV2.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLTopKV2.h deleted file mode 100644 index e301a5152..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLTopKV2.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2016-2018 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/** - * @file CLTopKV2.h - * @ingroup COM_AI_RUNTIME - * @brief This file contains arm_compute::CLTopKV2 class - */ -#ifndef __ARM_COMPUTE_CLTOPK_V2_H__ -#define __ARM_COMPUTE_CLTOPK_V2_H__ - -#include "arm_compute/core/CL/kernels/CLTopKV2Kernel.h" - -#include "arm_compute/runtime/IFunction.h" - -namespace arm_compute -{ -class ICLTensor; - -/** - * @brief Class to execute TopKV2 operation. - */ -class CLTopKV2 : public IFunction -{ -public: - /** - * @brief Construct a new CLTopKV2 object - */ - CLTopKV2(); - - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers) - */ - CLTopKV2(const CLTopKV2 &) = delete; - - /** - * @brief Prevent instances of this class from being copied (As this class contains pointers) - */ - CLTopKV2 &operator=(const CLTopKV2 &) = delete; - - /** - * @brief Construct a new CLTopKV2 object by using copy constructor - * @param[in] CLTopKV2 object to move - */ - CLTopKV2(CLTopKV2 &&) = default; - - /** - * @brief Assign a CLTopKV2 object. - * @param[in] CLTopKV2 object to assign. This object will be moved. - */ - CLTopKV2 &operator=(CLTopKV2 &&) = default; - - /** - * @brief Initialise the kernel's inputs and outputs. - * @param[in] input Input image. Data types supported: U8/S16/F32. - * @param[in] k The value of `k`. - * @param[out] values Top k values. Data types supported: S32 if input type is U8/S16, F32 if - * input type is F32. - * @param[out] indices Indices related to top k values. Data types supported: S32 if input type - * is U8/S16, F32 if input type is F32. - * @return N/A - */ - void configure(ICLTensor *input, int k, ICLTensor *values, ICLTensor *indices, - int total_bits = 32, int bits = 4); - - /** - * @brief Run the kernels contained in the function - * Depending on the value of the following environment variables it works differently: - * - If the value of environment variable "ACL_TOPKV2" == "GPU_SINGLE", - * quick sort on GPU is used. - * - If the value of environment variable "ACL_TOPKV2" == ""GPU"", - * radix sort on GPU is used. - * - For other value, TopKV2 runs on CPU - * @return N/A - */ - void run() override; - -private: - void run_on_cpu(); - void run_on_gpu(); - void run_on_gpu_single_quicksort(); - - uint32_t _k; - uint32_t _total_bits; - uint32_t _bits; - uint32_t _radix; - uint32_t _hist_buf_size; - uint32_t _glob_sum_buf_size; - uint32_t _n; - - ICLTensor *_input; - ICLTensor *_values; - ICLTensor *_indices; - - cl::Buffer _qs_idx_buf; - cl::Buffer _qs_temp_buf; - cl::Buffer _hist_buf; - cl::Buffer _glob_sum_buf; - cl::Buffer _temp_buf; - cl::Buffer _first_negative_idx_buf; - cl::Buffer _in_key_buf; - cl::Buffer _out_key_buf; - cl::Buffer _in_ind_buf; - cl::Buffer _out_ind_buf; - - cl::Buffer *_p_in_key_buf; - cl::Buffer *_p_out_key_buf; - cl::Buffer *_p_in_ind_buf; - cl::Buffer *_p_out_ind_buf; -// Disable GPU implementation -// TODO Enable GPU implementation with verification, or remove code -// Invalid result on GPU -#if 0 - CLTopKV2Single _qs_kernel; - CLTopKV2Init _init_kernel; - CLRadixSortHistogram _hist_kernel; - CLRadixSortScanHistogram _scan_hist_kernel; - CLRadixSortGlobalScanHistogram _glob_scan_hist_kernel; - CLRadixSortPasteHistogram _paste_hist_kernel; - CLRadixSortReorder _reorder_kernel; - CLTopKV2FindFirstNegative _find_first_negative_kernel; - CLTopKV2ReorderNegatives _reorder_negatives_kernel; - CLTopKV2Store _store_kernel; -#endif -}; -} -#endif // __ARM_COMPUTE_CLTOPK_V2_H__ diff --git a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLTransposeConvLayer.h b/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLTransposeConvLayer.h deleted file mode 100644 index 5fb102e47..000000000 --- a/compute/ARMComputeEx/arm_compute/runtime/CL/functions/CLTransposeConvLayer.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Copyright (c) 2017-2020 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef __ARM_COMPUTE_CLTRANSPOSECONVLAYER_H__ -#define __ARM_COMPUTE_CLTRANSPOSECONVLAYER_H__ - -#include "arm_compute/runtime/CL/functions/CLDirectTransposeConvLayer.h" -#include "arm_compute/runtime/CL/functions/CLGEMMDeconvolutionLayer.h" -#include "arm_compute/runtime/IFunction.h" -#include "arm_compute/runtime/IMemoryManager.h" - -#include <memory> - -namespace arm_compute -{ -/** Basic function to compute the deconvolution layer. This function calls the following OpenCL - * kernels/functions: - * - * -# @ref CLGEMMDeconvolutionLayer - * -# @ref CLDirectTransposeConvLayer - */ -class CLTransposeConvLayer : public IFunction -{ -public: - /** Default constructor */ - CLTransposeConvLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr); - - /** Set the input, weights, biases and output tensors. - * - * @param[in,out] input Input tensor. 3 lower dimensions represent a single input, and an - * optional 4th dimension for batch of inputs. Data types supported: QASYMM8_SIGNED/QASYMM8/F16/F32. - * @param[in] weights The 4d weights with dimensions [width, height, IFM, OFM]. Data type - * supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. Data type supported: Same - * as @p input. - * @param[out] output Output tensor. The output has the same number of dimensions as the - * @p input. - * @param[in] deconv_info Contains padding and policies to be used in the deconvolution, this - * is described in @ref PadStrideInfo. - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * @param[in] weights_info (Optional) Weights information needed for @ref CLConvolutionLayer, - * specifies if the weights tensor has been reshaped with @ref CLWeightsReshapeKernel. - * - */ - void configure(ICLTensor *input, ICLTensor *weights, const ICLTensor *bias, ICLTensor *output, - const PadStrideInfo &deconv_info, unsigned int invalid_right, - unsigned int invalid_bottom, const WeightsInfo &weights_info = WeightsInfo()); - /** Set the input, weights, biases and output tensors. - * - * @param[in] compile_context The compile context to be used. - * @param[in,out] input Input tensor. 3 lower dimensions represent a single input, and - * an optional 4th dimension for batch of inputs. Data types supported: - * QASYMM8_SIGNED/QASYMM8/F16/F32. - * @param[in] weights The 4d weights with dimensions [width, height, IFM, OFM]. Data - * type supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. Data type supported: - * Same as @p input. - * @param[out] output Output tensor. The output has the same number of dimensions as - * the @p input. - * @param[in] deconv_info Contains padding and policies to be used in the deconvolution, - * this is described in @ref PadStrideInfo. - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * @param[in] weights_info (Optional) Weights information needed for @ref - * CLConvolutionLayer, specifies if the weights tensor has been reshaped with @ref - * CLWeightsReshapeKernel. - * - */ - void configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *weights, - const ICLTensor *bias, ICLTensor *output, const PadStrideInfo &deconv_info, - unsigned int invalid_right, unsigned int invalid_bottom, - const WeightsInfo &weights_info = WeightsInfo()); - /** Static function to check if given info will lead to a valid configuration of @ref - * CLTransposeConvLayer - * - * @param[in] input Input tensor info. 3 lower dimensions represent a single input, and an - * optional 4th dimension for batch of inputs. Data types supported: QASYMM8_SIGNED/QASYMM8/F16/F32. - * @param[in] weights The 4d weights info with dimensions [width, height, IFM, OFM]. Data - * type supported: Same as @p input. - * @param[in] bias (Optional) The biases have one dimension. Data type supported: Same as - * @p input. - * @param[in] output Output tensor info. The output has the same number of dimensions as the - * @p input. - * @param[in] deconv_info Contains padding and policies to be used in the deconvolution, this is - * described in @ref PadStrideInfo. - * @param[in] invalid_right The number of zeros added to right edge of the output. - * @param[in] invalid_bottom The number of zeros added to bottom edge of the output. - * @param[in] weights_info (Optional) Weights information needed for @ref CLConvolutionLayer, - * specifies if the weights tensor has been reshaped with @ref CLWeightsReshapeKernel. - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *weights, - const ITensorInfo *bias, ITensorInfo *output, - const PadStrideInfo &deconv_info, unsigned int invalid_right, - unsigned int invalid_bottom, - const WeightsInfo &weights_info = WeightsInfo()); - - static DeconvolutionMethod - get_deconvolution_method(const ITensorInfo *input, const ITensorInfo *weights, - const ITensorInfo *bias, ITensorInfo *output, - const PadStrideInfo &deconv_info, unsigned int invalid_right, - unsigned int invalid_bottom, const WeightsInfo &weights_info); - // Inherited methods overridden: - void run() override; - void prepare() override; - -private: - std::shared_ptr<IMemoryManager> _memory_manager; - std::unique_ptr<IFunction> _function; -}; -} // namespace arm_compute -#endif /* __ARM_COMPUTE_CLTRANSPOSECONVLAYER_H__ */ |