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

Method PrintAnalysis

tensorflow/python/grappler/cost_analyzer.cc:166–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void CostAnalyzer::PrintAnalysis(std::ostream& os, bool per_node_report,
167 bool verbose) const {
168 os << std::endl;
169 os << std::left << std::setw(50)
170 << "Total time measured in ns (serialized): " << std::right
171 << std::setw(20) << total_time_measured_serialized_ << std::endl;
172 os << std::left << std::setw(50)
173 << "Total time measured in ns (actual): " << std::right << std::setw(20)
174 << total_time_measured_ << std::endl;
175 os << std::left << std::setw(50)
176 << "Total time analytical in ns (upper bound): " << std::right
177 << std::setw(20) << total_time_analytical_upper_ << std::endl;
178 os << std::left << std::setw(50)
179 << "Total time analytical in ns (lower bound): " << std::right
180 << std::setw(20) << total_time_analytical_lower_ << std::endl;
181 double efficiency_upper = static_cast<double>(total_time_analytical_upper_) /
182 static_cast<double>(total_time_measured_);
183 os << std::left << std::setw(50)
184 << "Overall efficiency (analytical upper/actual): " << std::right
185 << std::setw(20) << efficiency_upper << std::endl;
186 double efficiency_lower = static_cast<double>(total_time_analytical_lower_) /
187 static_cast<double>(total_time_measured_);
188 os << std::left << std::setw(50)
189 << "Overall efficiency (analytical lower/actual): " << std::right
190 << std::setw(20) << efficiency_lower << std::endl;
191 os << std::endl;
192
193 int width = 35;
194 int width_narrow = 15;
195 int width_wide = 20;
196 os << std::setw(width + 1) << "Op,";
197 os << std::setw(width_narrow + 1) << "Count,";
198 os << std::setw(width_wide + 1) << "Measured time (ns),";
199 os << std::setw(width_narrow + 2) << "Time percent,";
200 os << std::setw(width_narrow + 2) << "Acc percent,";
201 os << std::setw(width_wide + 1) << "Analytical upper,";
202 os << std::setw(width_wide + 1) << "Analytical lower,";
203 os << std::setw(width_narrow + 2) << "Overall eff";
204 os << std::setw(width_narrow + 2) << "Compute eff";
205 os << std::setw(width_narrow + 2) << "Memory eff" << std::endl;
206 float acc_percent = 0;
207 for (const auto& op : ops_) {
208 double percent = static_cast<double>(op.time) /
209 static_cast<double>(total_time_measured_serialized_);
210 double eff =
211 static_cast<double>(op.time_upper) / static_cast<double>(op.time);
212 double compute_eff =
213 static_cast<double>(op.compute_time) / static_cast<double>(op.time);
214 double memory_eff =
215 static_cast<double>(op.memory_time) / static_cast<double>(op.time);
216 os << std::setw(width) << op.name << ",";
217 os << std::setw(width_narrow) << op.count << ",";
218 os << std::setw(width_wide) << op.time << ",";
219 os << std::setw(width_narrow) << std::setprecision(2) << percent * 100
220 << "%,";
221 acc_percent += percent;
222 os << std::setw(width_narrow) << std::setprecision(2) << acc_percent * 100
223 << "%,";

Callers

nothing calls this directly

Calls 8

inputs_sizeMethod · 0.80
DebugStringMethod · 0.45
opMethod · 0.45
shapeMethod · 0.45
inputsMethod · 0.45
dim_sizeMethod · 0.45
sizeMethod · 0.45
dimMethod · 0.45

Tested by

no test coverage detected