35 assert(opcode !=
nullptr);
36 return std::max(opcode->builtin_code(),
37 static_cast<::tflite::BuiltinOperator
>(opcode->deprecated_builtin_code()));
40bool is_valid(const ::tflite::OperatorCode *opcode)
43 const int8_t deprecated_builtin_code = opcode->deprecated_builtin_code();
44 if (deprecated_builtin_code < 0)
47 const ::tflite::BuiltinOperator builtin_code = opcode->builtin_code();
48 if (!(::tflite::BuiltinOperator_MIN <= builtin_code &&
49 builtin_code <= ::tflite::BuiltinOperator_MAX))
55bool is_custom(const ::tflite::OperatorCode *opcode)
58 return (code == ::tflite::BuiltinOperator_CUSTOM);
61std::string
opcode_name(const ::tflite::OperatorCode *opcode)
67 std::ostringstream oss;
74 if (!opcode->custom_code())
75 return "(invalid custom)";
77 std::string custom_op =
"CUSTOM(";
78 custom_op += opcode->custom_code()->c_str();
84 return ::tflite::EnumNameBuiltinOperator(code);
87const char *
tensor_type(const ::tflite::Tensor *tensor)
89 return ::tflite::EnumNameTensorType(
tensor->type());
92const char *
tensor_name(const ::tflite::Tensor *tensor)
94 static const char *kEmptyTensorName =
"(noname)";
96 auto name =
tensor->name();
100 return kEmptyTensorName;
Code * code(const SessionID &sess)
std::string opcode_name(const ::tflite::OperatorCode *opcode)
bool is_valid(const ::tflite::OperatorCode *opcode)
::tflite::BuiltinOperator builtin_code_neutral(const ::tflite::OperatorCode *opcode)
bool is_custom(const ::tflite::OperatorCode *opcode)
const char * tensor_type(const ::tflite::Tensor *tensor)
const char * tensor_name(const ::tflite::Tensor *tensor)