MCPcopy Create free account
hub / github.com/ARM-software/armnn / GetPixelValue

Function GetPixelValue

src/backends/aclCommon/ArmComputeTensorUtils.cpp:419–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417}
418
419arm_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
450unsigned int ComputeDepthwiseConv2dDepthMultiplier(armnn::DataLayout layout,
451 const arm_compute::TensorShape& weightsShape,

Callers 6

ClFillWorkloadMethod · 0.85
ClPadWorkloadMethod · 0.85
ClPadValidateFunction · 0.85
NeonPadWorkloadMethod · 0.85
NeonPadWorkloadValidateFunction · 0.85
NeonFillWorkloadMethod · 0.85

Calls 3

isinfFunction · 0.85
to_stringFunction · 0.50

Tested by

no test coverage detected