Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 1 | /* |
Alessandro Navone | 6413e49 | 2021-02-02 11:39:05 +0000 | [diff] [blame] | 2 | * Copyright (c) 2018-2021 Arm Limited. |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +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 | */ |
Michalis Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 24 | #ifndef ARM_COMPUTE_GRAPH_TYPE_PRINTER_H |
| 25 | #define ARM_COMPUTE_GRAPH_TYPE_PRINTER_H |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 26 | |
| 27 | #include "arm_compute/core/Error.h" |
| 28 | #include "arm_compute/core/Types.h" |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 29 | #include "arm_compute/graph/Types.h" |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 30 | |
Georgios Pinitas | 12be7ab | 2018-07-03 12:06:23 +0100 | [diff] [blame] | 31 | #include "utils/TypePrinter.h" |
| 32 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 33 | namespace arm_compute |
| 34 | { |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 35 | namespace graph |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 36 | { |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 37 | /** Formatted output of the Target. */ |
| 38 | inline ::std::ostream &operator<<(::std::ostream &os, const Target &target) |
| 39 | { |
| 40 | switch(target) |
| 41 | { |
| 42 | case Target::UNSPECIFIED: |
| 43 | os << "UNSPECIFIED"; |
| 44 | break; |
| 45 | case Target::NEON: |
Sheri Zhang | ac6499a | 2021-02-10 15:32:38 +0000 | [diff] [blame] | 46 | os << "Neon"; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 47 | break; |
| 48 | case Target::CL: |
| 49 | os << "CL"; |
| 50 | break; |
Michalis Spyrou | 402740d | 2021-04-20 11:26:21 +0100 | [diff] [blame] | 51 | case Target::CLVK: |
| 52 | os << "CLVK"; |
| 53 | break; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 54 | default: |
| 55 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 56 | } |
| 57 | |
| 58 | return os; |
| 59 | } |
| 60 | |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 61 | inline ::std::ostream &operator<<(::std::ostream &os, const NodeType &node_type) |
| 62 | { |
| 63 | switch(node_type) |
| 64 | { |
| 65 | case NodeType::ActivationLayer: |
| 66 | os << "ActivationLayer"; |
| 67 | break; |
thecha01 | e8f05da | 2020-08-24 17:21:41 +0100 | [diff] [blame] | 68 | case NodeType::ArgMinMaxLayer: |
| 69 | os << "ArgMinMaxLayer"; |
| 70 | break; |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 71 | case NodeType::BatchNormalizationLayer: |
| 72 | os << "BatchNormalizationLayer"; |
| 73 | break; |
Manuel Bottini | d2048ce | 2018-10-23 17:00:42 +0100 | [diff] [blame] | 74 | case NodeType::BoundingBoxTransformLayer: |
| 75 | os << "BoundingBoxTransformLayer"; |
| 76 | break; |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 77 | case NodeType::ChannelShuffleLayer: |
| 78 | os << "ChannelShuffleLayer"; |
| 79 | break; |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 80 | case NodeType::ConcatenateLayer: |
| 81 | os << "ConcatenateLayer"; |
| 82 | break; |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 83 | case NodeType::ConvolutionLayer: |
| 84 | os << "ConvolutionLayer"; |
| 85 | break; |
| 86 | case NodeType::DeconvolutionLayer: |
| 87 | os << "DeconvolutionLayer"; |
| 88 | break; |
thecha01 | 0a05e6a | 2020-08-28 18:40:38 +0100 | [diff] [blame] | 89 | case NodeType::DepthToSpaceLayer: |
| 90 | os << "DepthToSpaceLayer"; |
| 91 | break; |
Isabella Gottardi | cd4e9ab | 2019-11-05 17:50:27 +0000 | [diff] [blame] | 92 | case NodeType::DequantizationLayer: |
| 93 | os << "DequantizationLayer"; |
| 94 | break; |
Isabella Gottardi | 7234ed8 | 2018-11-27 08:51:10 +0000 | [diff] [blame] | 95 | case NodeType::DetectionOutputLayer: |
| 96 | os << "DetectionOutputLayer"; |
| 97 | break; |
Isabella Gottardi | a7acb3c | 2019-01-08 13:48:44 +0000 | [diff] [blame] | 98 | case NodeType::DetectionPostProcessLayer: |
| 99 | os << "DetectionPostProcessLayer"; |
| 100 | break; |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 101 | case NodeType::DepthwiseConvolutionLayer: |
| 102 | os << "DepthwiseConvolutionLayer"; |
| 103 | break; |
| 104 | case NodeType::EltwiseLayer: |
| 105 | os << "EltwiseLayer"; |
| 106 | break; |
Sheri Zhang | 16dddd2 | 2020-05-27 15:03:48 +0100 | [diff] [blame] | 107 | case NodeType::UnaryEltwiseLayer: |
| 108 | os << "UnaryEltwiseLayer"; |
| 109 | break; |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 110 | case NodeType::FlattenLayer: |
| 111 | os << "FlattenLayer"; |
| 112 | break; |
| 113 | case NodeType::FullyConnectedLayer: |
| 114 | os << "FullyConnectedLayer"; |
| 115 | break; |
giuros01 | acce504 | 2019-02-21 17:32:34 +0000 | [diff] [blame] | 116 | case NodeType::FusedConvolutionBatchNormalizationLayer: |
| 117 | os << "FusedConvolutionBatchNormalizationLayer"; |
| 118 | break; |
ramelg01 | b75d624 | 2021-11-26 19:12:40 +0000 | [diff] [blame] | 119 | case NodeType::FusedConvolutionBatchNormalizationLayerWithPostOpsLayer: |
| 120 | os << "FusedConvolutionBatchNormalizationLayerWithPostOpsLayer"; |
| 121 | break; |
Sheri Zhang | fb22803 | 2021-11-02 10:45:07 +0000 | [diff] [blame] | 122 | case NodeType::FusedConvolutionWithPostOp: |
| 123 | os << "FusedConvolutionWithPostOp"; |
| 124 | break; |
Manuel Bottini | bffb41e | 2019-06-20 16:00:27 +0100 | [diff] [blame] | 125 | case NodeType::FusedDepthwiseConvolutionBatchNormalizationLayer: |
| 126 | os << "FusedDepthwiseConvolutionBatchNormalizationLayer"; |
| 127 | break; |
Manuel Bottini | 5209be5 | 2019-02-13 16:34:56 +0000 | [diff] [blame] | 128 | case NodeType::GenerateProposalsLayer: |
| 129 | os << "GenerateProposalsLayer"; |
| 130 | break; |
thecha01 | 3603aff | 2020-09-01 14:52:38 +0100 | [diff] [blame] | 131 | case NodeType::L2NormalizeLayer: |
| 132 | os << "L2NormalizeLayer"; |
Michalis Spyrou | 84392f4 | 2020-10-06 20:41:21 +0100 | [diff] [blame] | 133 | break; |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 134 | case NodeType::NormalizationLayer: |
| 135 | os << "NormalizationLayer"; |
| 136 | break; |
Michele Di Giorgio | 555d110 | 2018-09-12 13:51:59 +0100 | [diff] [blame] | 137 | case NodeType::NormalizePlanarYUVLayer: |
| 138 | os << "NormalizePlanarYUVLayer"; |
| 139 | break; |
Michele Di Giorgio | 4bb1733 | 2018-09-26 13:56:51 +0100 | [diff] [blame] | 140 | case NodeType::PadLayer: |
| 141 | os << "PadLayer"; |
| 142 | break; |
Georgios Pinitas | 57c4824 | 2018-08-02 13:41:49 +0100 | [diff] [blame] | 143 | case NodeType::PermuteLayer: |
| 144 | os << "PermuteLayer"; |
| 145 | break; |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 146 | case NodeType::PoolingLayer: |
| 147 | os << "PoolingLayer"; |
| 148 | break; |
Georgios Pinitas | f8c4749 | 2020-02-04 17:39:59 +0000 | [diff] [blame] | 149 | case NodeType::PReluLayer: |
| 150 | os << "PReluLayer"; |
| 151 | break; |
Giorgio Arena | 6e9d0e0 | 2020-01-03 15:02:04 +0000 | [diff] [blame] | 152 | case NodeType::PrintLayer: |
| 153 | os << "PrintLayer"; |
| 154 | break; |
Pablo Tello | 3252143 | 2018-11-15 14:43:10 +0000 | [diff] [blame] | 155 | case NodeType::PriorBoxLayer: |
| 156 | os << "PriorBoxLayer"; |
| 157 | break; |
Isabella Gottardi | 3db1ba9 | 2019-05-17 12:35:20 +0100 | [diff] [blame] | 158 | case NodeType::QuantizationLayer: |
| 159 | os << "QuantizationLayer"; |
| 160 | break; |
thecha01 | d64444b | 2020-09-07 14:50:21 +0100 | [diff] [blame] | 161 | case NodeType::ReductionOperationLayer: |
| 162 | os << "ReductionOperationLayer"; |
| 163 | break; |
Michele Di Giorgio | 555d110 | 2018-09-12 13:51:59 +0100 | [diff] [blame] | 164 | case NodeType::ReorgLayer: |
| 165 | os << "ReorgLayer"; |
| 166 | break; |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 167 | case NodeType::ReshapeLayer: |
| 168 | os << "ReshapeLayer"; |
| 169 | break; |
| 170 | case NodeType::ResizeLayer: |
| 171 | os << "ResizeLayer"; |
| 172 | break; |
Manuel Bottini | 3f9d4d7 | 2018-10-19 14:04:42 +0100 | [diff] [blame] | 173 | case NodeType::ROIAlignLayer: |
| 174 | os << "ROIAlignLayer"; |
| 175 | break; |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 176 | case NodeType::SoftmaxLayer: |
| 177 | os << "SoftmaxLayer"; |
| 178 | break; |
Michele Di Giorgio | c30b668 | 2018-09-12 17:44:08 +0100 | [diff] [blame] | 179 | case NodeType::SliceLayer: |
| 180 | os << "SliceLayer"; |
| 181 | break; |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 182 | case NodeType::SplitLayer: |
| 183 | os << "SplitLayer"; |
| 184 | break; |
Michele Di Giorgio | ec69975 | 2019-03-22 15:25:32 +0000 | [diff] [blame] | 185 | case NodeType::StackLayer: |
| 186 | os << "StackLayer"; |
| 187 | break; |
thecha01 | 2bfadd9 | 2020-08-12 17:25:51 +0100 | [diff] [blame] | 188 | case NodeType::StridedSliceLayer: |
| 189 | os << "StridedSliceLayer"; |
| 190 | break; |
Michalis Spyrou | 4e1c3f3 | 2018-09-20 17:14:03 +0100 | [diff] [blame] | 191 | case NodeType::UpsampleLayer: |
| 192 | os << "UpsampleLayer"; |
| 193 | break; |
Georgios Pinitas | da2491f | 2018-06-01 17:49:09 +0100 | [diff] [blame] | 194 | case NodeType::Input: |
| 195 | os << "Input"; |
| 196 | break; |
| 197 | case NodeType::Output: |
| 198 | os << "Output"; |
| 199 | break; |
| 200 | case NodeType::Const: |
| 201 | os << "Const"; |
| 202 | break; |
| 203 | case NodeType::Dummy: |
| 204 | os << "Dummy"; |
| 205 | break; |
| 206 | default: |
| 207 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 208 | } |
| 209 | |
| 210 | return os; |
| 211 | } |
| 212 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 213 | /** Formatted output of the EltwiseOperation type. */ |
| 214 | inline ::std::ostream &operator<<(::std::ostream &os, const EltwiseOperation &eltwise_op) |
| 215 | { |
| 216 | switch(eltwise_op) |
| 217 | { |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 218 | case EltwiseOperation::Add: |
| 219 | os << "Add"; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 220 | break; |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 221 | case EltwiseOperation::Mul: |
| 222 | os << "Mul"; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 223 | break; |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 224 | case EltwiseOperation::Sub: |
| 225 | os << "Sub"; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 226 | break; |
Alessandro Navone | 6413e49 | 2021-02-02 11:39:05 +0000 | [diff] [blame] | 227 | case EltwiseOperation::Div: |
| 228 | os << "Div"; |
| 229 | break; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 230 | default: |
| 231 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 232 | } |
| 233 | |
| 234 | return os; |
| 235 | } |
| 236 | |
| 237 | /** Formatted output of the ConvolutionMethod type. */ |
| 238 | inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethod &method) |
| 239 | { |
| 240 | switch(method) |
| 241 | { |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 242 | case ConvolutionMethod::Default: |
| 243 | os << "Default"; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 244 | break; |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 245 | case ConvolutionMethod::Direct: |
| 246 | os << "Direct"; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 247 | break; |
| 248 | case ConvolutionMethod::GEMM: |
| 249 | os << "GEMM"; |
| 250 | break; |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 251 | case ConvolutionMethod::Winograd: |
| 252 | os << "Winograd"; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 253 | break; |
| 254 | default: |
| 255 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 256 | } |
| 257 | |
| 258 | return os; |
| 259 | } |
| 260 | |
Giorgio Arena | 59631a1 | 2018-05-02 13:59:04 +0100 | [diff] [blame] | 261 | /** Formatted output of the FastMathHint type. */ |
| 262 | inline ::std::ostream &operator<<(::std::ostream &os, const FastMathHint &hint) |
| 263 | { |
| 264 | switch(hint) |
| 265 | { |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 266 | case FastMathHint::Enabled: |
| 267 | os << "Enabled"; |
Giorgio Arena | 59631a1 | 2018-05-02 13:59:04 +0100 | [diff] [blame] | 268 | break; |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 269 | case FastMathHint::Disabled: |
| 270 | os << "Disabled"; |
Giorgio Arena | 59631a1 | 2018-05-02 13:59:04 +0100 | [diff] [blame] | 271 | break; |
| 272 | default: |
| 273 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 274 | } |
| 275 | |
| 276 | return os; |
| 277 | } |
| 278 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 279 | /** Formatted output of the DepthwiseConvolutionMethod type. */ |
| 280 | inline ::std::ostream &operator<<(::std::ostream &os, const DepthwiseConvolutionMethod &method) |
| 281 | { |
| 282 | switch(method) |
| 283 | { |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 284 | case DepthwiseConvolutionMethod::Default: |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 285 | os << "DEFAULT"; |
| 286 | break; |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 287 | case DepthwiseConvolutionMethod::Optimized3x3: |
| 288 | os << "Optimized3x3"; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 289 | break; |
| 290 | default: |
| 291 | ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); |
| 292 | } |
| 293 | |
| 294 | return os; |
| 295 | } |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 296 | } // namespace graph |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 297 | } // namespace arm_compute |
Michalis Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 298 | #endif /* ARM_COMPUTE_GRAPH_TYPE_PRINTER_H */ |