| 237 | } |
| 238 | |
| 239 | void TFStats::AddOpLogProto(std::unique_ptr<OpLogProto> op_log) { |
| 240 | if (!op_log) { |
| 241 | return; |
| 242 | } |
| 243 | for (const auto& entry : op_log->id_to_string()) { |
| 244 | if (id_to_string_.find(entry.first) == id_to_string_.end()) { |
| 245 | id_to_string_[entry.first] = entry.second; |
| 246 | } |
| 247 | } |
| 248 | for (const OpLogEntry& entry : op_log->log_entries()) { |
| 249 | auto node = nodes_map_.find(entry.name()); |
| 250 | if (node == nodes_map_.end()) continue; |
| 251 | for (const string& type : entry.types()) { |
| 252 | node->second->AddOpType(type); |
| 253 | } |
| 254 | if (entry.float_ops()) { |
| 255 | node->second->AddFloatOps(entry.float_ops()); |
| 256 | } |
| 257 | if (entry.has_code_def()) { |
| 258 | has_code_traces_ = true; |
| 259 | node->second->AddCode(entry.code_def(), &id_to_string_); |
| 260 | } |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | void TFStats::AddRunMeta(int64 step, std::unique_ptr<RunMetadata> run_meta) { |
| 265 | if (!run_meta || !run_meta->has_step_stats()) { |