| 707 | } |
| 708 | |
| 709 | void 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 | |
| 744 | bool IsDynamic(TfLiteParserImpl::TensorRawPtr tensorPtr) |
| 745 | { |
no test coverage detected