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

Function GetGraphLabel

tensorflow/lite/toco/dump_graphviz.cc:710–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

708}
709
710string GetGraphLabel(const Model& model, const string& graph_name) {
711 // Use HTML-like labels (http://www.graphviz.org/doc/info/shapes.html#html)
712 string html;
713 html += "<";
714
715 // Begin Table
716 html += R"CODE(<FONT POINT-SIZE="36" FACE="Courier">)CODE";
717 html +=
718 R"CODE(<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0">)CODE";
719
720 // Name
721 html += R"CODE(<TR><TD COLSPAN="2" CELLPADDING="3" ALIGN="CENTER">)CODE";
722 html += R"CODE(<FONT POINT-SIZE="64" FACE="Helvetica"><B><I>)CODE";
723 html += graph_name;
724 html += R"CODE(</I></B></FONT>)CODE";
725 html += "</TD></TR>";
726
727 // Attributes
728 Attributes attrs;
729 attrs["arrays"] = StringF("%d", model.GetArrayMap().size());
730 if (!model.optional_arrays.empty()) {
731 attrs["optional arrays"] = StringF("%d", model.optional_arrays.size());
732 }
733 attrs["operators"] = StringF("%d", model.operators.size());
734 int64 ops_count;
735 if (EstimateArithmeticOpsCount(model, &ops_count) && (ops_count > 0)) {
736 attrs["math"] = FormattedNumber(ops_count) + "ops";
737 }
738 if (model.transient_data_size > 0) {
739 attrs["transient data size"] =
740 StringF("%d KiB", model.transient_data_size / 1024);
741 }
742 if (model.transient_data_alignment > 0) {
743 attrs["transient data alignment"] =
744 StringF("%d bytes", model.transient_data_alignment);
745 }
746 html += AttributesToHtml(attrs);
747
748 // End Table and HTML-like label
749 html += R"CODE(</TABLE></FONT>)CODE";
750 html += ">";
751
752 return html;
753}
754} // namespace
755
756void DumpGraphviz(const Model& model, string* output_file,

Callers 1

DumpGraphvizFunction · 0.85

Calls 6

StringFFunction · 0.85
FormattedNumberFunction · 0.85
AttributesToHtmlFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected