| 638 | } |
| 639 | |
| 640 | string TFCode::FormatNode(CodeNode* node, const Options& opts, |
| 641 | int64 indent) const { |
| 642 | std::vector<string> attrs; |
| 643 | if (opts.select.find(kShown[0]) != opts.select.end()) { |
| 644 | attrs.push_back(FormatNodeMemory(node, node->proto().requested_bytes(), |
| 645 | node->proto().total_requested_bytes())); |
| 646 | } |
| 647 | if (opts.select.find(kShown[11]) != opts.select.end()) { |
| 648 | attrs.push_back(FormatNodeMemory(node, node->proto().peak_bytes(), |
| 649 | node->proto().total_peak_bytes())); |
| 650 | } |
| 651 | if (opts.select.find(kShown[12]) != opts.select.end()) { |
| 652 | attrs.push_back(FormatNodeMemory(node, node->proto().residual_bytes(), |
| 653 | node->proto().total_residual_bytes())); |
| 654 | } |
| 655 | if (opts.select.find(kShown[13]) != opts.select.end()) { |
| 656 | attrs.push_back(FormatNodeMemory(node, node->proto().output_bytes(), |
| 657 | node->proto().total_output_bytes())); |
| 658 | } |
| 659 | |
| 660 | std::vector<string> time_attrs = FormatTimes(node, opts); |
| 661 | attrs.insert(attrs.end(), time_attrs.begin(), time_attrs.end()); |
| 662 | |
| 663 | if (opts.select.find(kShown[2]) != opts.select.end()) { |
| 664 | string params = FormatNumber(node->proto().total_parameters()) + " params"; |
| 665 | if (node->account) { |
| 666 | params = FormatNumber(node->proto().parameters()) + "/" + params; |
| 667 | } else { |
| 668 | params = "--/" + params; |
| 669 | } |
| 670 | attrs.push_back(params); |
| 671 | } |
| 672 | |
| 673 | if (opts.select.find(kShown[3]) != opts.select.end()) { |
| 674 | string fops = FormatNumber(node->proto().total_float_ops()) + " flops"; |
| 675 | if (node->account) { |
| 676 | fops = FormatNumber(node->proto().float_ops()) + "/" + fops; |
| 677 | } else { |
| 678 | fops = "--/" + fops; |
| 679 | } |
| 680 | attrs.push_back(fops); |
| 681 | } |
| 682 | |
| 683 | if (opts.select.find(kShown[5]) != opts.select.end() && |
| 684 | !node->node->devices().empty()) { |
| 685 | attrs.push_back(absl::StrJoin(node->node->devices(), "|")); |
| 686 | } |
| 687 | if (opts.select.find(kShown[6]) != opts.select.end()) { |
| 688 | std::set<string> op_types = node->node->op_types(); |
| 689 | attrs.push_back(absl::StrJoin(op_types, "|")); |
| 690 | } |
| 691 | if (opts.select.find(kShown[7]) != opts.select.end()) { |
| 692 | // TODO(xpan): Make op count available in code view? |
| 693 | attrs.push_back(strings::Printf("%s N/A in code view", kShown[7])); |
| 694 | } |
| 695 | if (opts.select.find(kShown[8]) != opts.select.end()) { |
| 696 | attrs.push_back(strings::Printf("%s N/A in code view", kShown[8])); |
| 697 | } |
nothing calls this directly
no test coverage detected