Isabella Gottardi | 0ae5de9 | 2019-03-14 10:32:11 +0000 | [diff] [blame] | 1 | /* |
Michele Di Giorgio | d9eaf61 | 2020-07-08 11:12:57 +0100 | [diff] [blame] | 2 | * Copyright (c) 2019-2020 Arm Limited. |
Isabella Gottardi | 0ae5de9 | 2019-03-14 10:32:11 +0000 | [diff] [blame] | 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 | */ |
Sang-Hoon Park | 797b76b | 2020-03-11 23:21:14 +0000 | [diff] [blame] | 24 | #ifndef ARM_COMPUTE_LAYER_DESCRIPTORS_H |
| 25 | #define ARM_COMPUTE_LAYER_DESCRIPTORS_H |
Isabella Gottardi | 0ae5de9 | 2019-03-14 10:32:11 +0000 | [diff] [blame] | 26 | |
| 27 | #include "arm_compute/core/Types.h" |
Sang-Hoon Park | 797b76b | 2020-03-11 23:21:14 +0000 | [diff] [blame] | 28 | #include "arm_compute/graph/Types.h" |
Isabella Gottardi | 0ae5de9 | 2019-03-14 10:32:11 +0000 | [diff] [blame] | 29 | |
| 30 | namespace arm_compute |
| 31 | { |
| 32 | namespace graph |
| 33 | { |
| 34 | namespace descriptors |
| 35 | { |
Georgios Pinitas | 9e4824c | 2019-04-12 13:15:58 +0100 | [diff] [blame] | 36 | /** Concatenate layer descriptor */ |
Isabella Gottardi | 0ae5de9 | 2019-03-14 10:32:11 +0000 | [diff] [blame] | 37 | struct ConcatLayerDescriptor |
| 38 | { |
| 39 | /** Default constructor */ |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame^] | 40 | ConcatLayerDescriptor() : axis(DataLayoutDimension::CHANNEL), output_qinfo() |
Isabella Gottardi | 0ae5de9 | 2019-03-14 10:32:11 +0000 | [diff] [blame] | 41 | { |
| 42 | } |
| 43 | |
| 44 | /** Constructor concatenate layer descriptor |
| 45 | * |
| 46 | * @param[in] axis Axis. |
| 47 | */ |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame^] | 48 | ConcatLayerDescriptor(DataLayoutDimension axis) : axis(axis), output_qinfo() |
Isabella Gottardi | 0ae5de9 | 2019-03-14 10:32:11 +0000 | [diff] [blame] | 49 | { |
| 50 | } |
| 51 | |
| 52 | /** Constructor concatenate layer descriptor |
| 53 | * |
| 54 | * @param[in] axis Axis. |
| 55 | * @param[in] output_qinfo Output quantization info. |
| 56 | */ |
| 57 | ConcatLayerDescriptor(DataLayoutDimension axis, QuantizationInfo output_qinfo) |
| 58 | : axis(axis), output_qinfo(output_qinfo) |
| 59 | { |
| 60 | } |
| 61 | |
| 62 | const DataLayoutDimension axis; /**< Concatenation Axis */ |
| 63 | const QuantizationInfo output_qinfo; /**< Output quantizazion info */ |
| 64 | }; |
Sang-Hoon Park | 797b76b | 2020-03-11 23:21:14 +0000 | [diff] [blame] | 65 | |
| 66 | /** Elementwise layer descriptor */ |
| 67 | struct EltwiseLayerDescriptor |
| 68 | { |
| 69 | /** Constructor |
| 70 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 71 | * @param[in] op Element-wise operation to perform |
| 72 | * @param[in] out_quant_info (Optional) Output quantization information. Defaults to empty @ref QuantizationInfo |
| 73 | * @param[in] c_policy (Optional) Convert policy used for the operation. Defaults to @ref ConvertPolicy::SATURATE |
| 74 | * @param[in] r_policy (Optional) Rounding policy used for the operation. Defaults to @ref RoundingPolicy::TO_ZERO |
| 75 | * @param[in] fused_activation (Optional) Fused activation information. Defaults to empty (identity) @ref ActivationLayerInfo |
Sang-Hoon Park | 797b76b | 2020-03-11 23:21:14 +0000 | [diff] [blame] | 76 | */ |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame^] | 77 | EltwiseLayerDescriptor(EltwiseOperation op, |
| 78 | QuantizationInfo out_quant_info = QuantizationInfo(), |
| 79 | ConvertPolicy c_policy = ConvertPolicy::SATURATE, |
| 80 | RoundingPolicy r_policy = RoundingPolicy::TO_ZERO, |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 81 | ActivationLayerInfo fused_activation = ActivationLayerInfo()) |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame^] | 82 | : op(op), |
| 83 | out_quant_info(out_quant_info), |
| 84 | c_policy(c_policy), |
| 85 | r_policy(r_policy), |
| 86 | fused_activation(fused_activation) |
Sang-Hoon Park | 797b76b | 2020-03-11 23:21:14 +0000 | [diff] [blame] | 87 | { |
| 88 | } |
| 89 | |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 90 | EltwiseOperation op; /**< Element-wise operation to perform */ |
| 91 | QuantizationInfo out_quant_info; /**< Output quantization information */ |
| 92 | ConvertPolicy c_policy; /**< Convert policy */ |
| 93 | RoundingPolicy r_policy; /**< Rounding policy */ |
| 94 | ActivationLayerInfo fused_activation; /**< Fused activation info */ |
Sang-Hoon Park | 797b76b | 2020-03-11 23:21:14 +0000 | [diff] [blame] | 95 | }; |
| 96 | |
Sheri Zhang | 16dddd2 | 2020-05-27 15:03:48 +0100 | [diff] [blame] | 97 | /** Unary Elementwise layer descriptor */ |
| 98 | struct UnaryEltwiseLayerDescriptor |
| 99 | { |
| 100 | /** Constructor |
| 101 | * |
| 102 | * @param[in] op Unary element-wise operation to perform |
| 103 | * @param[in] out_quant_info (Optional) Output quantization information. Defaults to empty @ref QuantizationInfo |
| 104 | * @param[in] c_policy (Optional) Convert policy used for the operation. Defaults to @ref ConvertPolicy::SATURATE |
| 105 | * @param[in] r_policy (Optional) Rounding policy used for the operation. Defaults to @ref RoundingPolicy::TO_ZERO |
| 106 | * @param[in] fused_activation (Optional) Fused activation information. Defaults to empty (identity) @ref ActivationLayerInfo |
| 107 | */ |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame^] | 108 | UnaryEltwiseLayerDescriptor(UnaryEltwiseOperation op, |
| 109 | QuantizationInfo out_quant_info = QuantizationInfo(), |
| 110 | ConvertPolicy c_policy = ConvertPolicy::SATURATE, |
| 111 | RoundingPolicy r_policy = RoundingPolicy::TO_ZERO, |
| 112 | ActivationLayerInfo fused_activation = ActivationLayerInfo()) |
| 113 | : op(op), |
| 114 | out_quant_info(out_quant_info), |
| 115 | c_policy(c_policy), |
| 116 | r_policy(r_policy), |
| 117 | fused_activation(fused_activation) |
Sheri Zhang | 16dddd2 | 2020-05-27 15:03:48 +0100 | [diff] [blame] | 118 | { |
| 119 | } |
| 120 | |
| 121 | UnaryEltwiseOperation op; /**< Unary element-wise operation to perform */ |
| 122 | QuantizationInfo out_quant_info; /**< Output quantization information */ |
| 123 | ConvertPolicy c_policy; /**< Convert policy */ |
| 124 | RoundingPolicy r_policy; /**< Rounding policy */ |
| 125 | ActivationLayerInfo fused_activation; /**< Fused activation info */ |
| 126 | }; |
| 127 | |
Sang-Hoon Park | 104fbd7 | 2020-03-13 11:31:53 +0000 | [diff] [blame] | 128 | /** Deconvolution layer descriptor */ |
| 129 | struct DeconvolutionLayerDescriptor |
| 130 | { |
| 131 | /** Constructor |
| 132 | * |
| 133 | * @param[in] info Dedonvolution layer attributes |
| 134 | * @param[in] out_quant_info (Optional) Output quantization infomation |
| 135 | */ |
| 136 | DeconvolutionLayerDescriptor(PadStrideInfo info, QuantizationInfo out_quant_info = QuantizationInfo()) |
| 137 | : info(info), out_quant_info(out_quant_info) |
| 138 | { |
| 139 | } |
| 140 | |
| 141 | PadStrideInfo info; /**< Padding and stride information */ |
| 142 | QuantizationInfo out_quant_info; /**< Output quantization information */ |
| 143 | }; |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame^] | 144 | } // namespace descriptors |
Isabella Gottardi | 0ae5de9 | 2019-03-14 10:32:11 +0000 | [diff] [blame] | 145 | } // namespace graph |
| 146 | } // namespace arm_compute |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame^] | 147 | #endif /* ARM_COMPUTE_LAYER_DESCRIPTORS_H */ |