| 417 | } |
| 418 | |
| 419 | arm_compute::PixelValue GetPixelValue(const arm_compute::ITensorInfo* tensorInfo, float value) |
| 420 | { |
| 421 | switch (tensorInfo->data_type()) |
| 422 | { |
| 423 | case arm_compute::DataType::F16: |
| 424 | { |
| 425 | arm_compute::PixelValue pixelValue = arm_compute::PixelValue(static_cast<Half>(value)); |
| 426 | if (isinf(pixelValue.get<Half>())) { |
| 427 | throw InvalidArgumentException("Under/Overflow converting float value [" + std::to_string(value) + |
| 428 | "] to fp16: [" + std::to_string(pixelValue.get<Half>()) + "]"); |
| 429 | } |
| 430 | return pixelValue; |
| 431 | } |
| 432 | case arm_compute::DataType::F32: |
| 433 | return arm_compute::PixelValue(value); |
| 434 | case arm_compute::DataType::QASYMM8: |
| 435 | return arm_compute::PixelValue(static_cast<uint8_t>(value)); |
| 436 | case arm_compute::DataType::QSYMM16: |
| 437 | return arm_compute::PixelValue(static_cast<int16_t>(value)); |
| 438 | case arm_compute::DataType::QSYMM8: |
| 439 | case arm_compute::DataType::QASYMM8_SIGNED: |
| 440 | case arm_compute::DataType::QSYMM8_PER_CHANNEL: |
| 441 | return arm_compute::PixelValue(static_cast<int8_t>(value)); |
| 442 | case arm_compute::DataType::S32: |
| 443 | return arm_compute::PixelValue(static_cast<int32_t>(value)); |
| 444 | default: |
| 445 | throw InvalidArgumentException("Unsupported DataType: [" + |
| 446 | std::to_string(static_cast<int>(tensorInfo->data_type())) + "]"); |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | unsigned int ComputeDepthwiseConv2dDepthMultiplier(armnn::DataLayout layout, |
| 451 | const arm_compute::TensorShape& weightsShape, |
no test coverage detected