MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / VerifyOps

Function VerifyOps

tensorflow/lite/tools/verifier.cc:365–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363}
364
365bool VerifyOps(const Model& model, const OpResolver& resolver,
366 ErrorReporter* error_reporter) {
367 if (!model.operator_codes()) {
368 return true;
369 }
370 for (const auto& opcode : *model.operator_codes()) {
371 if (opcode->builtin_code() < BuiltinOperator_MIN ||
372 opcode->builtin_code() > BuiltinOperator_MAX) {
373 ReportError(error_reporter, "Operator id '%d' is out of range.",
374 opcode->builtin_code());
375 return false;
376 }
377
378 if (opcode->builtin_code() == BuiltinOperator_CUSTOM) {
379 if (!resolver.FindOp(opcode->custom_code()->c_str(), opcode->version())) {
380 ReportError(error_reporter, "Unsupported custom op: %s, version: %d",
381 opcode->custom_code()->c_str(), opcode->version());
382 return false;
383 }
384 } else {
385 if (!resolver.FindOp(opcode->builtin_code(), opcode->version())) {
386 ReportError(error_reporter, "Unsupported builtin op: %s, version: %d",
387 EnumNameBuiltinOperator(opcode->builtin_code()),
388 opcode->version());
389 return false;
390 }
391 }
392 }
393 return true;
394}
395
396} // namespace
397

Callers 1

VerifyFunction · 0.85

Calls 5

EnumNameBuiltinOperatorFunction · 0.85
c_strMethod · 0.80
ReportErrorFunction · 0.70
FindOpMethod · 0.45
versionMethod · 0.45

Tested by

no test coverage detected