Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2020 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "HalPolicy.hpp" |
| 7 | |
| 8 | namespace armnn_driver |
| 9 | { |
| 10 | namespace hal_1_3 |
| 11 | { |
| 12 | |
| 13 | using namespace armnn; |
| 14 | |
| 15 | namespace |
| 16 | { |
| 17 | |
| 18 | } // anonymouse namespace |
| 19 | |
| 20 | bool HalPolicy::ConvertOperation(const Operation& operation, const Model& model, ConversionData& data) |
| 21 | { |
| 22 | switch (operation.type) |
| 23 | { |
| 24 | case V1_3::OperationType::ABS: |
| 25 | return ConvertElementwiseUnary(operation, model, data, UnaryOperation::Abs); |
| 26 | case V1_3::OperationType::ADD: |
| 27 | return ConvertAdd(operation, model, data); |
| 28 | case V1_3::OperationType::ARGMAX: |
| 29 | return ConvertArgMinMax(operation, model, data, ArgMinMaxFunction::Max); |
| 30 | case V1_3::OperationType::ARGMIN: |
| 31 | return ConvertArgMinMax(operation, model, data, ArgMinMaxFunction::Min); |
| 32 | case V1_3::OperationType::AVERAGE_POOL_2D: |
| 33 | return ConvertAveragePool2d(operation, model, data); |
| 34 | case V1_3::OperationType::BATCH_TO_SPACE_ND: |
| 35 | return ConvertBatchToSpaceNd(operation, model, data); |
| 36 | case V1_3::OperationType::CONCATENATION: |
| 37 | return ConvertConcatenation(operation, model, data); |
| 38 | case V1_3::OperationType::CONV_2D: |
| 39 | return ConvertConv2d(operation, model, data); |
| 40 | case V1_3::OperationType::DEPTH_TO_SPACE: |
| 41 | return ConvertDepthToSpace(operation, model, data); |
| 42 | case V1_3::OperationType::DEPTHWISE_CONV_2D: |
| 43 | return ConvertDepthwiseConv2d(operation, model, data); |
| 44 | case V1_3::OperationType::DEQUANTIZE: |
| 45 | return ConvertDequantize(operation, model, data); |
| 46 | case V1_3::OperationType::DIV: |
| 47 | return ConvertDiv(operation, model, data); |
Sadik Armagan | 51ba2c6 | 2020-03-31 15:36:25 +0100 | [diff] [blame] | 48 | case V1_3::OperationType::ELU: |
| 49 | return ConvertElu(operation, model, data); |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 50 | case V1_3::OperationType::EQUAL: |
| 51 | return ConvertComparison(operation, model, data, ComparisonOperation::Equal); |
Teresa Charlin | cb31b3b | 2020-09-30 18:28:18 +0100 | [diff] [blame] | 52 | case V1_3::OperationType::EXP: |
| 53 | return ConvertElementwiseUnary(operation, model, data, UnaryOperation::Exp); |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 54 | case V1_3::OperationType::EXPAND_DIMS: |
| 55 | return ConvertExpandDims(operation, model, data); |
Sadik Armagan | 2e32961 | 2020-06-24 10:57:23 +0100 | [diff] [blame] | 56 | case V1_3::OperationType::FILL: |
| 57 | return ConvertFill(operation, model, data); |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 58 | case V1_3::OperationType::FLOOR: |
| 59 | return ConvertFloor(operation, model, data); |
| 60 | case V1_3::OperationType::FULLY_CONNECTED: |
| 61 | return ConvertFullyConnected(operation, model, data); |
Teresa Charlin | f931af9 | 2020-04-10 16:46:53 +0100 | [diff] [blame] | 62 | case V1_3::OperationType::GATHER: |
| 63 | return ConvertGather(operation, model, data); |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 64 | case V1_3::OperationType::GREATER: |
| 65 | return ConvertComparison(operation, model, data, ComparisonOperation::Greater); |
| 66 | case V1_3::OperationType::GREATER_EQUAL: |
| 67 | return ConvertComparison(operation, model, data, ComparisonOperation::GreaterOrEqual); |
| 68 | case V1_3::OperationType::GROUPED_CONV_2D: |
| 69 | return ConvertGroupedConv2d(operation, model, data); |
Sadik Armagan | 51ba2c6 | 2020-03-31 15:36:25 +0100 | [diff] [blame] | 70 | case V1_3::OperationType::HARD_SWISH: |
| 71 | return ConvertHardSwish(operation, model, data); |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 72 | case V1_3::OperationType::INSTANCE_NORMALIZATION: |
| 73 | return ConvertInstanceNormalization(operation, model, data); |
| 74 | case V1_3::OperationType::L2_NORMALIZATION: |
| 75 | return ConvertL2Normalization(operation, model, data); |
| 76 | case V1_3::OperationType::L2_POOL_2D: |
| 77 | return ConvertL2Pool2d(operation, model, data); |
| 78 | case V1_3::OperationType::LESS: |
| 79 | return ConvertComparison(operation, model, data, ComparisonOperation::Less); |
| 80 | case V1_3::OperationType::LESS_EQUAL: |
| 81 | return ConvertComparison(operation, model, data, ComparisonOperation::LessOrEqual); |
| 82 | case V1_3::OperationType::LOCAL_RESPONSE_NORMALIZATION: |
| 83 | return ConvertLocalResponseNormalization(operation, model, data); |
Narumol Prangnawarat | 0629eb8 | 2020-11-12 18:27:37 +0000 | [diff] [blame] | 84 | case V1_3::OperationType::LOGICAL_AND: |
| 85 | return ConvertLogicalBinary(operation, model, data, LogicalBinaryOperation::LogicalAnd); |
| 86 | case V1_3::OperationType::LOGICAL_NOT: |
| 87 | return ConvertElementwiseUnary(operation, model, data, UnaryOperation::LogicalNot); |
| 88 | case V1_3::OperationType::LOGICAL_OR: |
| 89 | return ConvertLogicalBinary(operation, model, data, LogicalBinaryOperation::LogicalOr); |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 90 | case V1_3::OperationType::LOGISTIC: |
| 91 | return ConvertLogistic(operation, model, data); |
| 92 | case V1_3::OperationType::LOG_SOFTMAX: |
| 93 | return ConvertLogSoftmax(operation, model, data); |
| 94 | case V1_3::OperationType::LSTM: |
| 95 | return ConvertLstm(operation, model, data); |
| 96 | case V1_3::OperationType::MAX_POOL_2D: |
| 97 | return ConvertMaxPool2d(operation, model, data); |
| 98 | case V1_3::OperationType::MAXIMUM: |
| 99 | return ConvertMaximum(operation, model, data); |
| 100 | case V1_3::OperationType::MEAN: |
Teresa Charlin | 89cbb3a | 2021-02-11 21:00:47 +0000 | [diff] [blame^] | 101 | return ConvertReduce(operation, model, data, ReduceOperation::Mean); |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 102 | case V1_3::OperationType::MINIMUM: |
| 103 | return ConvertMinimum(operation, model, data); |
| 104 | case V1_3::OperationType::MUL: |
| 105 | return ConvertMul(operation, model, data); |
| 106 | case V1_3::OperationType::NEG: |
| 107 | return ConvertElementwiseUnary(operation, model, data, UnaryOperation::Neg); |
| 108 | case V1_3::OperationType::NOT_EQUAL: |
| 109 | return ConvertComparison(operation, model, data, ComparisonOperation::NotEqual); |
| 110 | case V1_3::OperationType::PAD: |
| 111 | return ConvertPad(operation, model, data); |
| 112 | case V1_3::OperationType::PAD_V2: |
| 113 | return ConvertPadV2(operation, model, data); |
| 114 | case V1_3::OperationType::PRELU: |
| 115 | return ConvertPrelu(operation, model, data); |
| 116 | case V1_3::OperationType::QUANTIZE: |
| 117 | return ConvertQuantize(operation, model, data); |
Sadik Armagan | 813f230 | 2020-05-19 14:10:30 +0100 | [diff] [blame] | 118 | case V1_3::OperationType::QUANTIZED_LSTM: |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 119 | return ConvertQuantizedLstm(operation, model, data); |
Sadik Armagan | 813f230 | 2020-05-19 14:10:30 +0100 | [diff] [blame] | 120 | case V1_3::OperationType::QUANTIZED_16BIT_LSTM: |
| 121 | return ConvertQuantized16BitLstm(operation, model, data); |
Finn Williams | fc884b4 | 2020-06-11 17:35:44 +0100 | [diff] [blame] | 122 | case V1_3::OperationType::RANK: |
| 123 | return ConvertRank(operation, model, data); |
Teresa Charlin | 89cbb3a | 2021-02-11 21:00:47 +0000 | [diff] [blame^] | 124 | case V1_3::OperationType::REDUCE_MAX: |
| 125 | return ConvertReduce(operation, model, data, ReduceOperation::Max); |
| 126 | case V1_3::OperationType::REDUCE_MIN: |
| 127 | return ConvertReduce(operation, model, data, ReduceOperation::Min); |
| 128 | case V1_3::OperationType::REDUCE_SUM: |
| 129 | return ConvertReduce(operation, model, data, ReduceOperation::Sum); |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 130 | case V1_3::OperationType::RELU: |
| 131 | return ConvertReLu(operation, model, data); |
| 132 | case V1_3::OperationType::RELU1: |
| 133 | return ConvertReLu1(operation, model, data); |
| 134 | case V1_3::OperationType::RELU6: |
| 135 | return ConvertReLu6(operation, model, data); |
| 136 | case V1_3::OperationType::RESHAPE: |
| 137 | return ConvertReshape(operation, model, data); |
| 138 | case V1_3::OperationType::RESIZE_BILINEAR: |
| 139 | return ConvertResize(operation, model, data, ResizeMethod::Bilinear); |
| 140 | case V1_3::OperationType::RESIZE_NEAREST_NEIGHBOR: |
| 141 | return ConvertResize(operation, model, data, ResizeMethod::NearestNeighbor); |
| 142 | case V1_3::OperationType::RSQRT: |
| 143 | return ConvertElementwiseUnary(operation, model, data, UnaryOperation::Rsqrt); |
| 144 | case V1_3::OperationType::SQRT: |
| 145 | return ConvertSqrt(operation, model, data); |
| 146 | case V1_3::OperationType::SQUEEZE: |
| 147 | return ConvertSqueeze(operation, model, data); |
| 148 | case V1_3::OperationType::STRIDED_SLICE: |
| 149 | return ConvertStridedSlice(operation, model, data); |
| 150 | case V1_3::OperationType::TRANSPOSE: |
| 151 | return ConvertTranspose(operation, model, data); |
| 152 | case V1_3::OperationType::TRANSPOSE_CONV_2D: |
| 153 | return ConvertTransposeConv2d(operation, model, data); |
| 154 | case V1_3::OperationType::SOFTMAX: |
| 155 | return ConvertSoftmax(operation, model, data); |
| 156 | case V1_3::OperationType::SPACE_TO_BATCH_ND : |
| 157 | return ConvertSpaceToBatchNd(operation, model, data); |
| 158 | case V1_3::OperationType::SPACE_TO_DEPTH: |
| 159 | return ConvertSpaceToDepth(operation, model, data); |
| 160 | case V1_3::OperationType::SUB: |
| 161 | return ConvertSub(operation, model, data); |
| 162 | case V1_3::OperationType::TANH: |
| 163 | return ConvertTanH(operation, model, data); |
| 164 | default: |
| 165 | return Fail("%s: Operation type %s not supported in ArmnnDriver", |
| 166 | __func__, toString(operation.type).c_str()); |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | bool HalPolicy::ConvertAdd(const Operation& operation, const Model& model, ConversionData& data) |
| 171 | { |
| 172 | ALOGV("hal_1_3::HalPolicy::ConvertAdd()"); |
| 173 | return ::ConvertAdd<hal_1_3::HalPolicy>(operation, model, data); |
| 174 | } |
| 175 | |
| 176 | bool HalPolicy::ConvertArgMinMax(const V1_3::Operation& operation, |
| 177 | const V1_3::Model& model, |
| 178 | ConversionData& data, |
| 179 | armnn::ArgMinMaxFunction argMinMaxFunction) |
| 180 | { |
| 181 | ALOGV("hal_1_3::HalPolicy::ConvertArgMinMax()"); |
| 182 | return ::ConvertArgMinMax<hal_1_3::HalPolicy>(operation, model, data, argMinMaxFunction); |
| 183 | } |
| 184 | |
| 185 | bool HalPolicy::ConvertAveragePool2d(const Operation& operation, const Model& model, ConversionData& data) |
| 186 | { |
| 187 | ALOGV("hal_1_3::HalPolicy::ConvertAveragePool2d()"); |
| 188 | return ConvertPooling2d<hal_1_3::HalPolicy>(operation, __func__, PoolingAlgorithm::Average, model, data); |
| 189 | } |
| 190 | |
| 191 | bool HalPolicy::ConvertBatchToSpaceNd(const Operation& operation, const Model& model, ConversionData& data) |
| 192 | { |
| 193 | ALOGV("hal_1_3::HalPolicy::ConvertBatchToSpaceNd()"); |
| 194 | return ::ConvertBatchToSpaceNd<hal_1_3::HalPolicy>(operation, model, data); |
| 195 | } |
| 196 | |
| 197 | bool HalPolicy::ConvertComparison(const Operation& operation, |
| 198 | const Model& model, |
| 199 | ConversionData& data, |
| 200 | ComparisonOperation comparisonOperation) |
| 201 | { |
| 202 | ALOGV("hal_1_3::HalPolicy::ConvertComparison()"); |
| 203 | return ::ConvertComparison_1_2<hal_1_3::HalPolicy>(operation, model, data, comparisonOperation); |
| 204 | } |
| 205 | |
| 206 | |
| 207 | bool HalPolicy::ConvertConcatenation(const Operation& operation, const Model& model, ConversionData& data) |
| 208 | { |
| 209 | ALOGV("hal_1_3::HalPolicy::ConvertConcatenation()"); |
| 210 | return ::ConvertConcatenation<hal_1_3::HalPolicy>(operation, model, data); |
| 211 | } |
| 212 | |
| 213 | bool HalPolicy::ConvertConv2d(const Operation& operation, const Model& model, ConversionData& data) |
| 214 | { |
| 215 | ALOGV("hal_1_3::HalPolicy::ConvertConv2d()"); |
| 216 | return ::ConvertConv2d_1_2<hal_1_3::HalPolicy>(operation, model, data); |
| 217 | } |
| 218 | |
| 219 | bool HalPolicy::ConvertDepthToSpace(const Operation& operation, const Model& model, ConversionData& data) |
| 220 | { |
| 221 | ALOGV("hal_1_3::HalPolicy::ConvertDepthToSpace()"); |
| 222 | return ::ConvertDepthToSpace<hal_1_3::HalPolicy>(operation, model, data); |
| 223 | } |
| 224 | |
| 225 | bool HalPolicy::ConvertDepthwiseConv2d(const Operation& operation, const Model& model, ConversionData& data) |
| 226 | { |
| 227 | ALOGV("hal_1_3::HalPolicy::ConvertDepthwiseConv2d()"); |
| 228 | return ::ConvertDepthwiseConv2d_1_2<hal_1_3::HalPolicy>(operation, model, data); |
| 229 | } |
| 230 | |
| 231 | bool HalPolicy::ConvertDequantize(const Operation& operation, const Model& model, ConversionData& data) |
| 232 | { |
| 233 | ALOGV("hal_1_3::HalPolicy::ConvertDequantize()"); |
| 234 | return ::ConvertDequantize_1_2<hal_1_3::HalPolicy>(operation, model, data); |
| 235 | } |
| 236 | |
| 237 | bool HalPolicy::ConvertDiv(const Operation& operation, const Model& model, ConversionData& data) |
| 238 | { |
| 239 | ALOGV("hal_1_3::HalPolicy::ConvertDiv()"); |
| 240 | return ::ConvertDiv<hal_1_3::HalPolicy>(operation, model, data); |
| 241 | } |
| 242 | |
| 243 | bool HalPolicy::ConvertElementwiseUnary(const Operation& operation, |
| 244 | const Model& model, |
| 245 | ConversionData& data, |
| 246 | UnaryOperation unaryOperation) |
| 247 | { |
| 248 | ALOGV("hal_1_3::HalPolicy::ConvertElementwiseUnary()"); |
| 249 | return ::ConvertElementwiseUnary<hal_1_3::HalPolicy>(operation, model, data, unaryOperation); |
| 250 | } |
| 251 | |
Sadik Armagan | 51ba2c6 | 2020-03-31 15:36:25 +0100 | [diff] [blame] | 252 | bool HalPolicy::ConvertElu(const Operation& operation, const Model& model, ConversionData& data) |
| 253 | { |
| 254 | ALOGV("hal_1_3::HalPolicy::ConvertElu()"); |
Sadik Armagan | 1153d1e | 2020-04-01 15:09:39 +0100 | [diff] [blame] | 255 | return ::ConvertElu<hal_1_3::HalPolicy>(operation, model, data); |
Sadik Armagan | 51ba2c6 | 2020-03-31 15:36:25 +0100 | [diff] [blame] | 256 | } |
| 257 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 258 | bool HalPolicy::ConvertExpandDims(const Operation& operation, const Model& model, ConversionData& data) |
| 259 | { |
| 260 | ALOGV("hal_1_3::HalPolicy::ConvertExpandDims()"); |
| 261 | return ::ConvertExpandDims<hal_1_3::HalPolicy>(operation, model, data); |
| 262 | } |
| 263 | |
Sadik Armagan | 2e32961 | 2020-06-24 10:57:23 +0100 | [diff] [blame] | 264 | bool HalPolicy::ConvertFill(const Operation& operation, const Model& model, ConversionData& data) |
| 265 | { |
| 266 | ALOGV("hal_1_3::HalPolicy::ConvertFill()"); |
| 267 | return ::ConvertFill<hal_1_3::HalPolicy>(operation, model, data); |
| 268 | } |
| 269 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 270 | bool HalPolicy::ConvertFloor(const Operation& operation, const Model& model, ConversionData& data) |
| 271 | { |
| 272 | ALOGV("hal_1_3::HalPolicy::ConvertFloor()"); |
| 273 | return ::ConvertFloor<hal_1_3::HalPolicy>(operation, model, data); |
| 274 | } |
| 275 | |
| 276 | bool HalPolicy::ConvertFullyConnected(const Operation& operation, const Model& model, ConversionData& data) |
| 277 | { |
| 278 | ALOGV("hal_1_3::HalPolicy::ConvertFullyConnected()"); |
| 279 | return ::ConvertFullyConnected<hal_1_3::HalPolicy>(operation, model, data); |
| 280 | } |
| 281 | |
Teresa Charlin | f931af9 | 2020-04-10 16:46:53 +0100 | [diff] [blame] | 282 | bool HalPolicy::ConvertGather(const Operation& operation, const Model& model, ConversionData& data) |
| 283 | { |
| 284 | ALOGV("hal_1_3::HalPolicy::ConvertGather()"); |
| 285 | return ::ConvertGather<hal_1_3::HalPolicy>(operation, model, data); |
| 286 | } |
| 287 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 288 | bool HalPolicy::ConvertGroupedConv2d(const Operation& operation, const Model& model, ConversionData& data) |
| 289 | { |
| 290 | ALOGV("hal_1_3::HalPolicy::ConvertGroupedConv2d()"); |
| 291 | return ::ConvertGroupedConv2d<hal_1_3::HalPolicy>(operation, model, data); |
| 292 | } |
| 293 | |
Sadik Armagan | 51ba2c6 | 2020-03-31 15:36:25 +0100 | [diff] [blame] | 294 | bool HalPolicy::ConvertHardSwish(const Operation& operation, const Model& model, ConversionData& data) |
| 295 | { |
| 296 | ALOGV("hal_1_3::HalPolicy::ConvertHardSwish()"); |
| 297 | ActivationDescriptor desc; |
| 298 | desc.m_Function = ActivationFunction::HardSwish; |
| 299 | |
| 300 | return ::ConvertToActivation<hal_1_3::HalPolicy>(operation, __func__, desc, model, data); |
| 301 | } |
| 302 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 303 | bool HalPolicy::ConvertInstanceNormalization(const Operation& operation, const Model& model, ConversionData& data) |
| 304 | { |
| 305 | ALOGV("hal_1_3::HalPolicy::ConvertInstanceNormalization()"); |
| 306 | return ::ConvertInstanceNormalization<hal_1_3::HalPolicy>(operation, model, data); |
| 307 | } |
| 308 | |
| 309 | bool HalPolicy::ConvertL2Normalization(const Operation& operation, const Model& model, ConversionData& data) |
| 310 | { |
| 311 | ALOGV("hal_1_3::HalPolicy::ConvertL2Normalization()"); |
| 312 | return ::ConvertL2Normalization<hal_1_3::HalPolicy>(operation, model, data); |
| 313 | } |
| 314 | |
| 315 | bool HalPolicy::ConvertL2Pool2d(const Operation& operation, const Model& model, ConversionData& data) |
| 316 | { |
| 317 | ALOGV("hal_1_3::HalPolicy::ConvertL2Pool2d()"); |
| 318 | return ConvertPooling2d<hal_1_3::HalPolicy>(operation, __func__, PoolingAlgorithm::L2, model, data); |
| 319 | } |
| 320 | |
| 321 | bool HalPolicy::ConvertLocalResponseNormalization(const Operation& operation, |
| 322 | const Model& model, |
| 323 | ConversionData& data) |
| 324 | { |
| 325 | ALOGV("hal_1_3::HalPolicy::ConvertLocalResponseNormalization()"); |
| 326 | return ::ConvertLocalResponseNormalization<hal_1_3::HalPolicy>(operation, model, data); |
| 327 | } |
| 328 | |
Narumol Prangnawarat | 0629eb8 | 2020-11-12 18:27:37 +0000 | [diff] [blame] | 329 | bool HalPolicy::ConvertLogicalBinary(const Operation& operation, |
| 330 | const Model& model, |
| 331 | ConversionData& data, |
| 332 | armnn::LogicalBinaryOperation logicalOperation) |
| 333 | { |
| 334 | ALOGV("hal_1_3::HalPolicy::ConvertLogicalBinary()"); |
| 335 | return ::ConvertLogicalBinary<hal_1_3::HalPolicy>(operation, model, data, logicalOperation); |
| 336 | } |
| 337 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 338 | bool HalPolicy::ConvertLogistic(const Operation& operation, const Model& model, ConversionData& data) |
| 339 | { |
| 340 | ALOGV("hal_1_3::HalPolicy::ConvertLogistic()"); |
| 341 | return ::ConvertLogistic<hal_1_3::HalPolicy>(operation, model, data); |
| 342 | } |
| 343 | |
| 344 | bool HalPolicy::ConvertLogSoftmax(const Operation& operation, const Model& model, ConversionData& data) |
| 345 | { |
| 346 | ALOGV("hal_1_3::HalPolicy::ConvertLogSoftmax()"); |
| 347 | return ::ConvertLogSoftmax<hal_1_3::HalPolicy>(operation, model, data); |
| 348 | } |
| 349 | |
| 350 | bool HalPolicy::ConvertLstm(const Operation& operation, const Model& model, ConversionData& data) |
| 351 | { |
| 352 | ALOGV("hal_1_3::HalPolicy::ConvertLstm()"); |
| 353 | return ::ConvertLstm<hal_1_3::HalPolicy>(operation, model, data); |
| 354 | } |
| 355 | |
| 356 | bool HalPolicy::ConvertMaxPool2d(const Operation& operation, const Model& model, ConversionData& data) |
| 357 | { |
| 358 | ALOGV("hal_1_3::HalPolicy::ConvertMaxPool2d()"); |
| 359 | return ConvertPooling2d<hal_1_3::HalPolicy>(operation, __func__, PoolingAlgorithm::Max, model, data); |
| 360 | } |
| 361 | |
| 362 | bool HalPolicy::ConvertMaximum(const Operation& operation, const Model& model, ConversionData& data) |
| 363 | { |
Teresa Charlin | 5821aa2 | 2020-11-17 19:23:47 +0000 | [diff] [blame] | 364 | ALOGV("hal_1_3::HalPolicy::ConvertMaximum()"); |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 365 | return ::ConvertMaximum<hal_1_3::HalPolicy>(operation, model, data); |
| 366 | } |
| 367 | |
Teresa Charlin | 89cbb3a | 2021-02-11 21:00:47 +0000 | [diff] [blame^] | 368 | bool HalPolicy::ConvertReduce(const Operation& operation, const Model& model, ConversionData& data, |
| 369 | ReduceOperation reduceOperation) |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 370 | { |
Teresa Charlin | 89cbb3a | 2021-02-11 21:00:47 +0000 | [diff] [blame^] | 371 | ALOGV("hal_1_3::HalPolicy::ConvertReduce()"); |
| 372 | return ::ConvertReduce<hal_1_3::HalPolicy>(operation, model, data, reduceOperation); |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 373 | } |
| 374 | |
| 375 | bool HalPolicy::ConvertMinimum(const Operation& operation, const Model& model, ConversionData& data) |
| 376 | { |
| 377 | ALOGV("hal_1_3::HalPolicy::ConvertMinimum()"); |
| 378 | return ::ConvertMinimum<hal_1_3::HalPolicy>(operation, model, data); |
| 379 | } |
| 380 | |
| 381 | bool HalPolicy::ConvertMul(const Operation& operation, const Model& model, ConversionData& data) |
| 382 | { |
| 383 | ALOGV("hal_1_3::HalPolicy::ConvertMul()"); |
| 384 | return ::ConvertMul<hal_1_3::HalPolicy>(operation, model, data); |
| 385 | } |
| 386 | |
| 387 | bool HalPolicy::ConvertPad(const Operation& operation, const Model& model, ConversionData& data) |
| 388 | { |
| 389 | ALOGV("hal_1_3::HalPolicy::ConvertPad()"); |
| 390 | return ::ConvertPad<hal_1_3::HalPolicy>(operation, model, data); |
| 391 | } |
| 392 | |
| 393 | bool HalPolicy::ConvertPadV2(const Operation& operation, const Model& model, ConversionData& data) |
| 394 | { |
| 395 | ALOGV("hal_1_3::HalPolicy::ConvertPadV2()"); |
| 396 | return ::ConvertPadV2<hal_1_3::HalPolicy>(operation, model, data); |
| 397 | } |
| 398 | |
| 399 | bool HalPolicy::ConvertPrelu(const Operation& operation, const Model& model, ConversionData& data) |
| 400 | { |
| 401 | ALOGV("hal_1_3::HalPolicy::ConvertPrelu()"); |
| 402 | return ::ConvertPrelu<hal_1_3::HalPolicy>(operation, model, data); |
| 403 | } |
| 404 | |
| 405 | bool HalPolicy::ConvertQuantize(const Operation& operation, const Model& model, ConversionData& data) |
| 406 | { |
| 407 | ALOGV("hal_1_3::HalPolicy::ConvertQuantize()"); |
| 408 | return ::ConvertQuantize<hal_1_3::HalPolicy>(operation, model, data); |
| 409 | } |
| 410 | |
| 411 | bool HalPolicy::ConvertQuantizedLstm(const Operation& operation, const Model& model, ConversionData& data) |
| 412 | { |
| 413 | ALOGV("hal_1_3::HalPolicy::ConvertQuantizedLstm()"); |
| 414 | return ::ConvertQuantizedLstm<hal_1_3::HalPolicy>(operation, model, data); |
| 415 | } |
| 416 | |
Sadik Armagan | 813f230 | 2020-05-19 14:10:30 +0100 | [diff] [blame] | 417 | bool HalPolicy::ConvertQuantized16BitLstm(const Operation& operation, const Model& model, ConversionData& data) |
| 418 | { |
| 419 | ALOGV("hal_1_3::HalPolicy::ConvertQuantized16BitLstm()"); |
| 420 | return ::ConvertQuantized16BitLstm<hal_1_3::HalPolicy>(operation, model, data); |
| 421 | } |
| 422 | |
Finn Williams | fc884b4 | 2020-06-11 17:35:44 +0100 | [diff] [blame] | 423 | bool HalPolicy::ConvertRank(const Operation& operation, const Model& model, ConversionData& data) |
| 424 | { |
| 425 | ALOGV("hal_1_3::HalPolicy::ConvertRank()"); |
| 426 | return ::ConvertRank<hal_1_3::HalPolicy>(operation, model, data); |
| 427 | } |
| 428 | |
Kevin May | 42477c1 | 2020-03-26 13:34:14 +0000 | [diff] [blame] | 429 | bool HalPolicy::ConvertReLu(const Operation& operation, const Model& model, ConversionData& data) |
| 430 | { |
| 431 | ALOGV("hal_1_3::HalPolicy::ConvertReLu()"); |
| 432 | return ::ConvertReLu<hal_1_3::HalPolicy>(operation, model, data); |
| 433 | } |
| 434 | |
| 435 | bool HalPolicy::ConvertReLu1(const Operation& operation, const Model& model, ConversionData& data) |
| 436 | { |
| 437 | ALOGV("hal_1_3::HalPolicy::ConvertReLu1()"); |
| 438 | return ::ConvertReLu1<hal_1_3::HalPolicy>(operation, model, data); |
| 439 | } |
| 440 | |
| 441 | bool HalPolicy::ConvertReLu6(const Operation& operation, const Model& model, ConversionData& data) |
| 442 | { |
| 443 | ALOGV("hal_1_3::HalPolicy::ConvertReLu6()"); |
| 444 | return ::ConvertReLu6<hal_1_3::HalPolicy>(operation, model, data); |
| 445 | } |
| 446 | |
| 447 | bool HalPolicy::ConvertReshape(const Operation& operation, const Model& model, ConversionData& data) |
| 448 | { |
| 449 | ALOGV("hal_1_3::HalPolicy::ConvertReshape()"); |
| 450 | return ::ConvertReshape<hal_1_3::HalPolicy>(operation, model, data); |
| 451 | } |
| 452 | |
| 453 | bool HalPolicy::ConvertResize(const Operation& operation, |
| 454 | const Model& model, |
| 455 | ConversionData& data, |
| 456 | ResizeMethod resizeMethod) |
| 457 | { |
| 458 | ALOGV("hal_1_3::HalPolicy::ConvertResize()"); |
| 459 | return ::ConvertResize<hal_1_3::HalPolicy>(operation, model, data, resizeMethod); |
| 460 | } |
| 461 | |
| 462 | bool HalPolicy::ConvertSpaceToBatchNd(const Operation& operation, const Model& model, ConversionData& data) |
| 463 | { |
| 464 | ALOGV("hal_1_3::HalPolicy::ConvertSpaceToBatchNd()"); |
| 465 | return ::ConvertSpaceToBatchNd<hal_1_3::HalPolicy>(operation, model, data); |
| 466 | } |
| 467 | |
| 468 | bool HalPolicy::ConvertSpaceToDepth(const Operation& operation, const Model& model, ConversionData& data) |
| 469 | { |
| 470 | ALOGV("hal_1_3::HalPolicy::ConvertSpaceToDepth()"); |
| 471 | return ::ConvertSpaceToDepth<hal_1_3::HalPolicy>(operation, model, data); |
| 472 | } |
| 473 | |
| 474 | bool HalPolicy::ConvertSoftmax(const Operation& operation, const Model& model, ConversionData& data) |
| 475 | { |
| 476 | ALOGV("hal_1_3::HalPolicy::ConvertSoftmax()"); |
| 477 | return ::ConvertSoftmax<hal_1_3::HalPolicy>(operation, model, data); |
| 478 | } |
| 479 | |
| 480 | bool HalPolicy::ConvertSub(const Operation& operation, const Model& model, ConversionData& data) |
| 481 | { |
| 482 | ALOGV("hal_1_3::HalPolicy::ConvertSub()"); |
| 483 | return ::ConvertSub<hal_1_3::HalPolicy>(operation, model, data); |
| 484 | } |
| 485 | |
| 486 | bool HalPolicy::ConvertTanH(const Operation& operation, const Model& model, ConversionData& data) |
| 487 | { |
| 488 | ALOGV("hal_1_3::HalPolicy::ConvertTanH()"); |
| 489 | return ::ConvertTanH<hal_1_3::HalPolicy>(operation, model, data); |
| 490 | } |
| 491 | |
| 492 | bool HalPolicy::ConvertTransposeConv2d(const Operation& operation, const Model& model, ConversionData& data) |
| 493 | { |
| 494 | ALOGV("hal_1_3::HalPolicy::ConvertTransposeConv2d()"); |
| 495 | return ::ConvertTransposeConv2d<hal_1_3::HalPolicy>(operation, model, data); |
| 496 | } |
| 497 | |
| 498 | bool HalPolicy::ConvertSqrt(const Operation& operation, const Model& model, ConversionData& data) |
| 499 | { |
| 500 | ALOGV("hal_1_3::HalPolicy::ConvertSqrt()"); |
| 501 | ActivationDescriptor desc; |
| 502 | desc.m_Function = ActivationFunction::Sqrt; |
| 503 | |
| 504 | return ::ConvertToActivation<hal_1_3::HalPolicy>(operation, __func__, desc, model, data); |
| 505 | } |
| 506 | |
| 507 | bool HalPolicy::ConvertSqueeze(const Operation& operation, const Model& model, ConversionData& data) |
| 508 | { |
| 509 | ALOGV("hal_1_3::HalPolicy::ConvertSqueeze()"); |
| 510 | return ::ConvertSqueeze<hal_1_3::HalPolicy>(operation, model, data); |
| 511 | } |
| 512 | |
| 513 | bool HalPolicy::ConvertStridedSlice(const Operation& operation, const Model& model, ConversionData& data) |
| 514 | { |
| 515 | ALOGV("hal_1_3::HalPolicy::ConvertStridedSlice()"); |
| 516 | return ::ConvertStridedSlice<hal_1_3::HalPolicy>(operation, model, data); |
| 517 | } |
| 518 | |
| 519 | bool HalPolicy::ConvertTranspose(const Operation& operation, const Model& model, ConversionData& data) |
| 520 | { |
| 521 | ALOGV("hal_1_3::HalPolicy::ConvertTranspose()"); |
| 522 | return ::ConvertTranspose<hal_1_3::HalPolicy>(operation, model, data); |
| 523 | } |
| 524 | |
| 525 | } // namespace hal_1_3 |
| 526 | } // namespace armnn_driver |