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 */ |
| 40 | ConcatLayerDescriptor() |
| 41 | : axis(DataLayoutDimension::CHANNEL), output_qinfo() |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | /** Constructor concatenate layer descriptor |
| 46 | * |
| 47 | * @param[in] axis Axis. |
| 48 | */ |
| 49 | ConcatLayerDescriptor(DataLayoutDimension axis) |
| 50 | : axis(axis), output_qinfo() |
| 51 | { |
| 52 | } |
| 53 | |
| 54 | /** Constructor concatenate layer descriptor |
| 55 | * |
| 56 | * @param[in] axis Axis. |
| 57 | * @param[in] output_qinfo Output quantization info. |
| 58 | */ |
| 59 | ConcatLayerDescriptor(DataLayoutDimension axis, QuantizationInfo output_qinfo) |
| 60 | : axis(axis), output_qinfo(output_qinfo) |
| 61 | { |
| 62 | } |
| 63 | |
| 64 | const DataLayoutDimension axis; /**< Concatenation Axis */ |
| 65 | const QuantizationInfo output_qinfo; /**< Output quantizazion info */ |
| 66 | }; |
Sang-Hoon Park | 797b76b | 2020-03-11 23:21:14 +0000 | [diff] [blame] | 67 | |
| 68 | /** Elementwise layer descriptor */ |
| 69 | struct EltwiseLayerDescriptor |
| 70 | { |
| 71 | /** Constructor |
| 72 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 73 | * @param[in] op Element-wise operation to perform |
| 74 | * @param[in] out_quant_info (Optional) Output quantization information. Defaults to empty @ref QuantizationInfo |
| 75 | * @param[in] c_policy (Optional) Convert policy used for the operation. Defaults to @ref ConvertPolicy::SATURATE |
| 76 | * @param[in] r_policy (Optional) Rounding policy used for the operation. Defaults to @ref RoundingPolicy::TO_ZERO |
| 77 | * @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] | 78 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 79 | EltwiseLayerDescriptor(EltwiseOperation op, QuantizationInfo out_quant_info = QuantizationInfo(), ConvertPolicy c_policy = ConvertPolicy::SATURATE, RoundingPolicy r_policy = RoundingPolicy::TO_ZERO, |
| 80 | ActivationLayerInfo fused_activation = ActivationLayerInfo()) |
| 81 | : op(op), out_quant_info(out_quant_info), c_policy(c_policy), r_policy(r_policy), fused_activation(fused_activation) |
Sang-Hoon Park | 797b76b | 2020-03-11 23:21:14 +0000 | [diff] [blame] | 82 | { |
| 83 | } |
| 84 | |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 85 | EltwiseOperation op; /**< Element-wise operation to perform */ |
| 86 | QuantizationInfo out_quant_info; /**< Output quantization information */ |
| 87 | ConvertPolicy c_policy; /**< Convert policy */ |
| 88 | RoundingPolicy r_policy; /**< Rounding policy */ |
| 89 | ActivationLayerInfo fused_activation; /**< Fused activation info */ |
Sang-Hoon Park | 797b76b | 2020-03-11 23:21:14 +0000 | [diff] [blame] | 90 | }; |
| 91 | |
Sheri Zhang | 16dddd2 | 2020-05-27 15:03:48 +0100 | [diff] [blame] | 92 | /** Unary Elementwise layer descriptor */ |
| 93 | struct UnaryEltwiseLayerDescriptor |
| 94 | { |
| 95 | /** Constructor |
| 96 | * |
| 97 | * @param[in] op Unary element-wise operation to perform |
| 98 | * @param[in] out_quant_info (Optional) Output quantization information. Defaults to empty @ref QuantizationInfo |
| 99 | * @param[in] c_policy (Optional) Convert policy used for the operation. Defaults to @ref ConvertPolicy::SATURATE |
| 100 | * @param[in] r_policy (Optional) Rounding policy used for the operation. Defaults to @ref RoundingPolicy::TO_ZERO |
| 101 | * @param[in] fused_activation (Optional) Fused activation information. Defaults to empty (identity) @ref ActivationLayerInfo |
| 102 | */ |
| 103 | UnaryEltwiseLayerDescriptor(UnaryEltwiseOperation op, QuantizationInfo out_quant_info = QuantizationInfo(), ConvertPolicy c_policy = ConvertPolicy::SATURATE, |
| 104 | RoundingPolicy r_policy = RoundingPolicy::TO_ZERO, |
| 105 | ActivationLayerInfo fused_activation = ActivationLayerInfo()) |
| 106 | : op(op), out_quant_info(out_quant_info), c_policy(c_policy), r_policy(r_policy), fused_activation(fused_activation) |
| 107 | { |
| 108 | } |
| 109 | |
| 110 | UnaryEltwiseOperation op; /**< Unary element-wise operation to perform */ |
| 111 | QuantizationInfo out_quant_info; /**< Output quantization information */ |
| 112 | ConvertPolicy c_policy; /**< Convert policy */ |
| 113 | RoundingPolicy r_policy; /**< Rounding policy */ |
| 114 | ActivationLayerInfo fused_activation; /**< Fused activation info */ |
| 115 | }; |
| 116 | |
Sang-Hoon Park | 104fbd7 | 2020-03-13 11:31:53 +0000 | [diff] [blame] | 117 | /** Deconvolution layer descriptor */ |
| 118 | struct DeconvolutionLayerDescriptor |
| 119 | { |
| 120 | /** Constructor |
| 121 | * |
| 122 | * @param[in] info Dedonvolution layer attributes |
| 123 | * @param[in] out_quant_info (Optional) Output quantization infomation |
| 124 | */ |
| 125 | DeconvolutionLayerDescriptor(PadStrideInfo info, QuantizationInfo out_quant_info = QuantizationInfo()) |
| 126 | : info(info), out_quant_info(out_quant_info) |
| 127 | { |
| 128 | } |
| 129 | |
| 130 | PadStrideInfo info; /**< Padding and stride information */ |
| 131 | QuantizationInfo out_quant_info; /**< Output quantization information */ |
| 132 | }; |
Isabella Gottardi | 0ae5de9 | 2019-03-14 10:32:11 +0000 | [diff] [blame] | 133 | } // namespace descriptor |
| 134 | } // namespace graph |
| 135 | } // namespace arm_compute |
Sang-Hoon Park | 797b76b | 2020-03-11 23:21:14 +0000 | [diff] [blame] | 136 | #endif /* ARM_COMPUTE_LAYER_DESCRIPTORS_H */ |