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

Function Export

tensorflow/lite/toco/toco_tooling.cc:458–493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458tensorflow::Status Export(const TocoFlags& toco_flags, const Model& model,
459 bool allow_custom_ops, string* output_file_contents) {
460 switch (toco_flags.output_format()) {
461 case TENSORFLOW_GRAPHDEF:
462 ExportTensorFlowGraphDef(model, output_file_contents);
463 break;
464 case TFLITE: {
465 toco::tflite::ExportParams params;
466
467 params.enable_select_tf_ops =
468 toco_flags.force_select_tf_ops() || toco_flags.enable_select_tf_ops();
469 params.allow_custom_ops = allow_custom_ops;
470 params.allow_dynamic_tensors = toco_flags.allow_dynamic_tensors();
471
472 if (toco_flags.post_training_quantize()) {
473 if (toco_flags.quantize_to_float16()) {
474 params.quantize_weights = tflite::QuantizedBufferType::FLOAT16;
475 } else {
476 params.quantize_weights = tflite::QuantizedBufferType::INT8;
477 }
478 }
479 auto status = toco::tflite::Export(model, output_file_contents, params);
480 if (!status.ok()) {
481 LOG(ERROR) << status.error_message();
482 }
483 return status;
484 } break;
485 case GRAPHVIZ_DOT:
486 DumpGraphviz(model, output_file_contents, "Computation Graph");
487 break;
488 default:
489 LOG(FATAL) << "Unhandled output_format='"
490 << FileFormat_Name(toco_flags.output_format()) << "'";
491 }
492 return tensorflow::Status();
493}
494
495} // namespace toco

Callers

nothing calls this directly

Calls 4

ExportTensorFlowGraphDefFunction · 0.85
DumpGraphvizFunction · 0.85
StatusClass · 0.50
okMethod · 0.45

Tested by

no test coverage detected