Change the implementation of getter methods of schema utils.
This is to address the problem of supporting quantized models that contain zero-valued deprecated builtin code for Dequantize ops in the newer version of the runtime. PiperOrigin-RevId: 336765278 Change-Id: I668698bc01145799041672b2e0e9ebc5858ed979
This commit is contained in:
parent
35aeaec772
commit
cf28969fb2
@ -14,6 +14,8 @@ limitations under the License.
|
||||
==============================================================================*/
|
||||
#include "tensorflow/lite/schema/schema_utils.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "tensorflow/lite/kernels/internal/compatibility.h"
|
||||
|
||||
namespace tflite {
|
||||
@ -44,18 +46,17 @@ BuiltinOperator GetBuiltinCode(const OperatorCode *op_code) {
|
||||
// Caller should guarantee that the given argument value is not a nullptr.
|
||||
TFLITE_DCHECK(op_code != nullptr);
|
||||
|
||||
return (op_code->builtin_code() ? op_code->builtin_code()
|
||||
: static_cast<BuiltinOperator>(
|
||||
op_code->deprecated_builtin_code()));
|
||||
return std::max(
|
||||
op_code->builtin_code(),
|
||||
static_cast<BuiltinOperator>(op_code->deprecated_builtin_code()));
|
||||
}
|
||||
|
||||
BuiltinOperator GetBuiltinCode(const OperatorCodeT *op_code) {
|
||||
// Caller should guarantee that the given argument value is not a nullptr.
|
||||
TFLITE_DCHECK(op_code != nullptr);
|
||||
|
||||
return (op_code->builtin_code
|
||||
? op_code->builtin_code
|
||||
: static_cast<BuiltinOperator>(op_code->deprecated_builtin_code));
|
||||
return std::max(op_code->builtin_code, static_cast<BuiltinOperator>(
|
||||
op_code->deprecated_builtin_code));
|
||||
}
|
||||
|
||||
int8_t ConvertBuiltinCodeToDeprecatedBuiltinCode(
|
||||
|
Loading…
Reference in New Issue
Block a user