Command handler for node_info. Query information about a given node. Args: args: Command-line arguments, excluding the command prefix, as a list of str. screen_info: Optional dict input containing screen information such as cols. Returns: Output text
(self, args, screen_info=None)
| 738 | return debugger_cli_common.RichTextLines([row], font_attr_segs=attr_segs) |
| 739 | |
| 740 | def node_info(self, args, screen_info=None): |
| 741 | """Command handler for node_info. |
| 742 | |
| 743 | Query information about a given node. |
| 744 | |
| 745 | Args: |
| 746 | args: Command-line arguments, excluding the command prefix, as a list of |
| 747 | str. |
| 748 | screen_info: Optional dict input containing screen information such as |
| 749 | cols. |
| 750 | |
| 751 | Returns: |
| 752 | Output text lines as a RichTextLines object. |
| 753 | """ |
| 754 | |
| 755 | # TODO(cais): Add annotation of substrings for node names, to facilitate |
| 756 | # on-screen highlighting/selection of node names. |
| 757 | _ = screen_info |
| 758 | |
| 759 | parsed = self._arg_parsers["node_info"].parse_args(args) |
| 760 | |
| 761 | # Get a node name, regardless of whether the input is a node name (without |
| 762 | # output slot attached) or a tensor name (with output slot attached). |
| 763 | node_name, unused_slot = debug_graphs.parse_node_or_tensor_name( |
| 764 | parsed.node_name) |
| 765 | |
| 766 | if not self._debug_dump.node_exists(node_name): |
| 767 | output = cli_shared.error( |
| 768 | "There is no node named \"%s\" in the partition graphs" % node_name) |
| 769 | _add_main_menu( |
| 770 | output, |
| 771 | node_name=None, |
| 772 | enable_list_tensors=True, |
| 773 | enable_node_info=False, |
| 774 | enable_list_inputs=False, |
| 775 | enable_list_outputs=False) |
| 776 | return output |
| 777 | |
| 778 | # TODO(cais): Provide UI glossary feature to explain to users what the |
| 779 | # term "partition graph" means and how it is related to TF graph objects |
| 780 | # in Python. The information can be along the line of: |
| 781 | # "A tensorflow graph defined in Python is stripped of unused ops |
| 782 | # according to the feeds and fetches and divided into a number of |
| 783 | # partition graphs that may be distributed among multiple devices and |
| 784 | # hosts. The partition graphs are what's actually executed by the C++ |
| 785 | # runtime during a run() call." |
| 786 | |
| 787 | lines = ["Node %s" % node_name] |
| 788 | font_attr_segs = { |
| 789 | 0: [(len(lines[-1]) - len(node_name), len(lines[-1]), "bold")] |
| 790 | } |
| 791 | lines.append("") |
| 792 | lines.append(" Op: %s" % self._debug_dump.node_op_type(node_name)) |
| 793 | lines.append(" Device: %s" % self._debug_dump.node_device(node_name)) |
| 794 | output = debugger_cli_common.RichTextLines( |
| 795 | lines, font_attr_segs=font_attr_segs) |
| 796 | |
| 797 | # List node inputs (non-control and control). |