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

Function AddStep

tensorflow/core/profiler/internal/print_model_analysis.cc:123–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123double AddStep(int64 step, const string* graph, const string* run_meta,
124 const string* op_log) {
125 CHECK(tf_stat);
126
127 if (graph && !graph->empty()) {
128 std::unique_ptr<GraphDef> graph_ptr(new GraphDef());
129 if (!graph_ptr->ParseFromString(*graph)) {
130 if (!protobuf::TextFormat::ParseFromString(*graph, graph_ptr.get())) {
131 fprintf(stderr, "Failed to parse graph\n");
132 }
133 }
134 tf_stat->AddGraph(std::move(graph_ptr));
135 }
136
137 CHECK(run_meta && !run_meta->empty());
138 // TODO(xpan): Better error handling.
139 std::unique_ptr<RunMetadata> run_meta_ptr(new RunMetadata());
140 run_meta_ptr->ParseFromString(*run_meta);
141 tf_stat->AddRunMeta(step, std::move(run_meta_ptr));
142
143 if (op_log && !op_log->empty()) {
144 std::unique_ptr<OpLogProto> op_log_ptr;
145 op_log_ptr.reset(new OpLogProto());
146 op_log_ptr->ParseFromString(*op_log);
147 tf_stat->AddOpLogProto(std::move(op_log_ptr));
148 }
149 return tf_stat->run_coverage();
150}
151
152string Profile(const string* command, const string* options) {
153 CHECK(tf_stat);

Callers

nothing calls this directly

Calls 8

AddGraphMethod · 0.80
AddRunMetaMethod · 0.80
AddOpLogProtoMethod · 0.80
run_coverageMethod · 0.80
emptyMethod · 0.45
ParseFromStringMethod · 0.45
getMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected