Create an instance of CursesUI based on a DebugDumpDir object. Args: debug_dump: (debug_data.DebugDumpDir) The debug dump to use. tensor_filters: (dict) A dict mapping tensor filter name (str) to tensor filter (Callable). ui_type: (str) requested UI type, e.g., "curses", "readli
(debug_dump,
tensor_filters=None,
ui_type="curses",
on_ui_exit=None,
config=None)
| 1580 | |
| 1581 | |
| 1582 | def create_analyzer_ui(debug_dump, |
| 1583 | tensor_filters=None, |
| 1584 | ui_type="curses", |
| 1585 | on_ui_exit=None, |
| 1586 | config=None): |
| 1587 | """Create an instance of CursesUI based on a DebugDumpDir object. |
| 1588 | |
| 1589 | Args: |
| 1590 | debug_dump: (debug_data.DebugDumpDir) The debug dump to use. |
| 1591 | tensor_filters: (dict) A dict mapping tensor filter name (str) to tensor |
| 1592 | filter (Callable). |
| 1593 | ui_type: (str) requested UI type, e.g., "curses", "readline". |
| 1594 | on_ui_exit: (`Callable`) the callback to be called when the UI exits. |
| 1595 | config: A `cli_config.CLIConfig` object. |
| 1596 | |
| 1597 | Returns: |
| 1598 | (base_ui.BaseUI) A BaseUI subtype object with a set of standard analyzer |
| 1599 | commands and tab-completions registered. |
| 1600 | """ |
| 1601 | if config is None: |
| 1602 | config = cli_config.CLIConfig() |
| 1603 | |
| 1604 | analyzer = DebugAnalyzer(debug_dump, config=config) |
| 1605 | if tensor_filters: |
| 1606 | for tensor_filter_name in tensor_filters: |
| 1607 | analyzer.add_tensor_filter( |
| 1608 | tensor_filter_name, tensor_filters[tensor_filter_name]) |
| 1609 | |
| 1610 | cli = ui_factory.get_ui(ui_type, on_ui_exit=on_ui_exit, config=config) |
| 1611 | cli.register_command_handler( |
| 1612 | "list_tensors", |
| 1613 | analyzer.list_tensors, |
| 1614 | analyzer.get_help("list_tensors"), |
| 1615 | prefix_aliases=["lt"]) |
| 1616 | cli.register_command_handler( |
| 1617 | "node_info", |
| 1618 | analyzer.node_info, |
| 1619 | analyzer.get_help("node_info"), |
| 1620 | prefix_aliases=["ni"]) |
| 1621 | cli.register_command_handler( |
| 1622 | "list_inputs", |
| 1623 | analyzer.list_inputs, |
| 1624 | analyzer.get_help("list_inputs"), |
| 1625 | prefix_aliases=["li"]) |
| 1626 | cli.register_command_handler( |
| 1627 | "list_outputs", |
| 1628 | analyzer.list_outputs, |
| 1629 | analyzer.get_help("list_outputs"), |
| 1630 | prefix_aliases=["lo"]) |
| 1631 | cli.register_command_handler( |
| 1632 | "print_tensor", |
| 1633 | analyzer.print_tensor, |
| 1634 | analyzer.get_help("print_tensor"), |
| 1635 | prefix_aliases=["pt"]) |
| 1636 | cli.register_command_handler( |
| 1637 | "print_source", |
| 1638 | analyzer.print_source, |
| 1639 | analyzer.get_help("print_source"), |
nothing calls this directly
no test coverage detected