1 /* 2 * Copyright (c) 2017-2022 Arm Limited. 3 * 4 * SPDX-License-Identifier: MIT 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to 8 * deal in the Software without restriction, including without limitation the 9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 * sell copies of the Software, and to permit persons to whom the Software is 11 * furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in all 14 * copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 * SOFTWARE. 23 */ 24 #ifndef ARM_COMPUTE_CPUWINOGRADCONV2DKERNEL_H 25 #define ARM_COMPUTE_CPUWINOGRADCONV2DKERNEL_H 26 27 #include "arm_compute/core/Helpers.h" 28 #include "arm_compute/core/ITensor.h" 29 #include "arm_compute/core/ITensorPack.h" 30 #include "arm_compute/core/Steps.h" 31 #include "arm_compute/core/TensorInfo.h" 32 #include "arm_compute/runtime/Tensor.h" 33 #include "src/core/NEON/kernels/assembly/winograd.hpp" 34 #include "src/core/NEON/kernels/convolution/common/tensor.hpp" 35 #include "src/cpu/ICpuKernel.h" 36 37 namespace arm_compute 38 { 39 namespace cpu 40 { 41 class CpuWinogradConv2dTransformInputKernel final : public ICpuKernel<CpuWinogradConv2dTransformInputKernel> 42 { 43 public: 44 /** Prevent instances of this class from being copied (As this class contains pointers) */ 45 CpuWinogradConv2dTransformInputKernel(const CpuWinogradConv2dTransformInputKernel &) = delete; 46 47 /** Prevent instances of this class from being copied (As this class contains pointers) */ 48 CpuWinogradConv2dTransformInputKernel &operator=(const CpuWinogradConv2dTransformInputKernel &) = delete; 49 50 /** Prevent instances of this class from being moved it contains references.*/ 51 CpuWinogradConv2dTransformInputKernel(CpuWinogradConv2dTransformInputKernel &&) = delete; 52 53 /** Prevent instances of this class from being moved it contains references.*/ 54 CpuWinogradConv2dTransformInputKernel &operator=(CpuWinogradConv2dTransformInputKernel &&) = delete; 55 56 CpuWinogradConv2dTransformInputKernel(arm_conv::winograd::WinogradImpl &w_impl, arm_conv::ConvolutionArgs &_c_args, uint32_t nthreads); 57 58 // Inherited methods overridden: 59 void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override; 60 name()61 const char *name() const override 62 { 63 return "CpuWinogradConv2dTransformInputKernel"; 64 } 65 66 private: 67 arm_conv::winograd::WinogradImpl &_winograd_impl; 68 arm_conv::ConvolutionArgs &_conv_args; 69 uint32_t _nthreads; 70 }; 71 class CpuWinogradConv2dTransformOutputKernel : public ICpuKernel<CpuWinogradConv2dTransformOutputKernel> 72 { 73 public: 74 /** Prevent instances of this class from being copied (As this class contains pointers) */ 75 CpuWinogradConv2dTransformOutputKernel(const CpuWinogradConv2dTransformOutputKernel &) = delete; 76 77 /** Prevent instances of this class from being copied (As this class contains pointers) */ 78 CpuWinogradConv2dTransformOutputKernel &operator=(const CpuWinogradConv2dTransformOutputKernel &) = delete; 79 80 /** Prevent instances of this class from being moved it contains references.*/ 81 CpuWinogradConv2dTransformOutputKernel(CpuWinogradConv2dTransformOutputKernel &&) = delete; 82 83 /** Prevent instances of this class from being moved it contains references.*/ 84 CpuWinogradConv2dTransformOutputKernel &operator=(CpuWinogradConv2dTransformOutputKernel &&) = delete; 85 86 CpuWinogradConv2dTransformOutputKernel(arm_conv::winograd::WinogradImpl &w_impl, arm_conv::ConvolutionArgs &_c_args, uint32_t nthreads); 87 88 // Inherited methods overridden: 89 void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override; 90 name()91 const char *name() const override 92 { 93 return "CpuWinogradConv2dTransformOutputKernel"; 94 } 95 96 private: 97 arm_conv::winograd::WinogradImpl &_winograd_impl; 98 const arm_conv::ConvolutionArgs &_conv_args; 99 uint32_t _nthreads; 100 }; 101 102 } // namespace cpu 103 } // namespace arm_compute 104 #endif /*ARM_COMPUTE_CPUWINOGRADCONV2DKERNEL_H*/ 105