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

Function CheckMatchingQuantization

src/armnnTfLiteParser/TfLiteParser.cpp:709–742  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

707}
708
709void CheckMatchingQuantization(const TensorInfo& first,
710 const TensorInfo& second,
711 const std::string& descName,
712 std::string const& firstName,
713 std::string const& secondName)
714{
715 if (!first.IsQuantized() ||
716 !second.IsQuantized())
717 {
718 // Not a quantized type, ignore the validation
719 return;
720 }
721
722 DataType firstDataType = first.GetDataType();
723 DataType secondDataType = second.GetDataType();
724
725 if (firstDataType != secondDataType)
726 {
727 throw InvalidArgumentException(descName + ": " + firstName + " and " + secondName +
728 " must be of the same quantized type, " +
729 firstName + " is " + GetDataTypeName(firstDataType) + ", " +
730 secondName + " is " + GetDataTypeName(secondDataType));
731 }
732
733 if (!first.IsTypeSpaceMatch(second))
734 {
735 throw InvalidArgumentException(descName + ": " + firstName + " and " + secondName +
736 " must have the same quantization space, " +
737 firstName + " has offset " + std::to_string(first.GetQuantizationOffset()) +
738 " and scale " + std::to_string(first.GetQuantizationScale()) + ", " +
739 secondName + " has offset " + std::to_string(second.GetQuantizationOffset()) +
740 " and scale " + std::to_string(second.GetQuantizationScale()));
741 }
742}
743
744bool IsDynamic(TfLiteParserImpl::TensorRawPtr tensorPtr)
745{

Callers 14

ParseExpandDimsMethod · 0.85
ParseTransposeMethod · 0.85
ParseBatchToSpaceNDMethod · 0.85
ParseMaximumMethod · 0.85
ParseMinimumMethod · 0.85
ParsePoolMethod · 0.85
ParseSliceMethod · 0.85
ParseSpaceToBatchNDMethod · 0.85
ParseSqueezeMethod · 0.85
ParseReshapeMethod · 0.85
ParseResizeMethod · 0.85
ParsePowerMethod · 0.85

Calls 8

GetDataTypeNameFunction · 0.85
IsQuantizedMethod · 0.80
IsTypeSpaceMatchMethod · 0.80
to_stringFunction · 0.50
GetDataTypeMethod · 0.45
GetQuantizationOffsetMethod · 0.45
GetQuantizationScaleMethod · 0.45

Tested by

no test coverage detected