Generate main menu for the screen output from a command. Args: output: (debugger_cli_common.RichTextLines) the output object to modify. node_name: (str or None) name of the node involved (if any). If None, the menu items node_info, list_inputs and list_outputs will be automati
(output,
node_name=None,
enable_list_tensors=True,
enable_node_info=True,
enable_print_tensor=True,
enable_list_inputs=True,
enable_list_outputs=True)
| 59 | |
| 60 | |
| 61 | def _add_main_menu(output, |
| 62 | node_name=None, |
| 63 | enable_list_tensors=True, |
| 64 | enable_node_info=True, |
| 65 | enable_print_tensor=True, |
| 66 | enable_list_inputs=True, |
| 67 | enable_list_outputs=True): |
| 68 | """Generate main menu for the screen output from a command. |
| 69 | |
| 70 | Args: |
| 71 | output: (debugger_cli_common.RichTextLines) the output object to modify. |
| 72 | node_name: (str or None) name of the node involved (if any). If None, |
| 73 | the menu items node_info, list_inputs and list_outputs will be |
| 74 | automatically disabled, overriding the values of arguments |
| 75 | enable_node_info, enable_list_inputs and enable_list_outputs. |
| 76 | enable_list_tensors: (bool) whether the list_tensor menu item will be |
| 77 | enabled. |
| 78 | enable_node_info: (bool) whether the node_info item will be enabled. |
| 79 | enable_print_tensor: (bool) whether the print_tensor item will be enabled. |
| 80 | enable_list_inputs: (bool) whether the item list_inputs will be enabled. |
| 81 | enable_list_outputs: (bool) whether the item list_outputs will be enabled. |
| 82 | """ |
| 83 | |
| 84 | menu = debugger_cli_common.Menu() |
| 85 | |
| 86 | menu.append( |
| 87 | debugger_cli_common.MenuItem( |
| 88 | "list_tensors", "list_tensors", enabled=enable_list_tensors)) |
| 89 | |
| 90 | if node_name: |
| 91 | menu.append( |
| 92 | debugger_cli_common.MenuItem( |
| 93 | "node_info", |
| 94 | "node_info -a -d -t %s" % node_name, |
| 95 | enabled=enable_node_info)) |
| 96 | menu.append( |
| 97 | debugger_cli_common.MenuItem( |
| 98 | "print_tensor", |
| 99 | "print_tensor %s" % node_name, |
| 100 | enabled=enable_print_tensor)) |
| 101 | menu.append( |
| 102 | debugger_cli_common.MenuItem( |
| 103 | "list_inputs", |
| 104 | "list_inputs -c -r %s" % node_name, |
| 105 | enabled=enable_list_inputs)) |
| 106 | menu.append( |
| 107 | debugger_cli_common.MenuItem( |
| 108 | "list_outputs", |
| 109 | "list_outputs -c -r %s" % node_name, |
| 110 | enabled=enable_list_outputs)) |
| 111 | else: |
| 112 | menu.append( |
| 113 | debugger_cli_common.MenuItem( |
| 114 | "node_info", None, enabled=False)) |
| 115 | menu.append( |
| 116 | debugger_cli_common.MenuItem("print_tensor", None, enabled=False)) |
| 117 | menu.append( |
| 118 | debugger_cli_common.MenuItem("list_inputs", None, enabled=False)) |
no test coverage detected