1 /* 2 * Copyright (c) 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 25 #ifndef SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESIZE 26 #define SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESIZE 27 28 #include "arm_compute/dynamic_fusion/sketch/attributes/ResizeAttributes.h" 29 #include "src/dynamic_fusion/sketch/gpu/components/IGpuKernelComponent.h" 30 31 namespace arm_compute 32 { 33 /** Forward declaration */ 34 class ITensorInfo; 35 namespace experimental 36 { 37 namespace dynamic_fusion 38 { 39 /** Forward declaration */ 40 template <typename T> 41 class ArgumentPack; 42 43 /** Forward declaration */ 44 class ClTemplateResize; 45 46 class ClComponentResize final : public IGpuKernelComponent 47 { 48 public: 49 /** Attributes are a set of backend-agnostic parameters that define what a component does */ 50 using Attributes = ResizeAttributes; 51 52 /** Validate the component 53 * 54 * @param[in] properties Component properties @ref Properties 55 * @param[in,out] tensors Tensor arguments to the component 56 * @param[in] attributes Component attributes @ref Attributes 57 * 58 * @return Status Validation results 59 * 60 * Tensor argument names: 61 * - ACL_SRC_0: Input 62 * - ACL_DST_0: Output 63 * 64 * Tensor argument constness: 65 * - ACL_SRC_0: Const 66 * - ACL_DST_0: Const 67 * 68 * Valid data layouts: 69 * - NHWC 70 * 71 ** Valid data type configurations: 72 * |ACL_SRC_0 |ACL_DST_0 | 73 * |:--------------|:--------------| 74 * |QASYMM8 |QASYMM8 | 75 * |QASYMM8_SIGNED |QASYMM8_SIGNED | 76 * |F16 |F16 | 77 * |F32 |F32 | 78 * |U8 |U8 | 79 * |S16 |S16 | 80 */ 81 static Status validate( 82 const Properties &properties, 83 const ArgumentPack<ITensorInfo> &tensors, 84 const Attributes &attributes); 85 86 /** Constructor 87 * 88 * Similar to @ref ClComponentResize::validate() 89 */ 90 ClComponentResize(ComponentId id, 91 const Properties &properties, 92 const ArgumentPack<ITensorInfo> &tensors, 93 const Attributes &attributes); 94 95 /** Destructor */ 96 ~ClComponentResize() override; 97 98 /** Prevent instances of this class from being copy constructed */ 99 ClComponentResize(const ClComponentResize &component) = delete; 100 101 /** Prevent instances of this class from being copied */ 102 ClComponentResize &operator=(const ClComponentResize &component) = delete; 103 104 /** Allow instances of this class to be move constructed */ 105 ClComponentResize(ClComponentResize &&component) = default; 106 107 /** Allow instances of this class to be moved */ 108 ClComponentResize &operator=(ClComponentResize &&component) = default; 109 110 /** Get template writer for the component */ 111 const IGpuTemplateComponentWriter *template_writer() const override; 112 113 /** Get component type */ type()114 GpuComponentType type() const override 115 { 116 return GpuComponentType::Complex; 117 } 118 119 private: 120 std::unique_ptr<ClTemplateResize> _component_writer; 121 }; 122 123 } // namespace dynamic_fusion 124 } // namespace experimental 125 } // namespace arm_compute 126 127 #endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_COMPONENTS_CL_CLCOMPONENTRESIZE */ 128