예제 #1
0
  def list_outputs(self, args, screen_info=None):
    """Command handler for inputs.

    Show inputs to 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 lines as a RichTextLines object.
    """

    # Screen info not currently used by this handler. Include this line to
    # mute pylint.
    _ = screen_info
    # TODO(cais): Use screen info to format the output lines more prettily,
    # e.g., hanging indent of long node names.

    parsed = self._arg_parsers["list_outputs"].parse_args(args)

    output = self._list_inputs_or_outputs(
        parsed.recursive,
        parsed.node_name,
        parsed.depth,
        parsed.control,
        parsed.op_type,
        do_outputs=True)

    node_name = debug_data.get_node_name(parsed.node_name)
    _add_main_menu(output, node_name=node_name, enable_list_outputs=False)

    return output
예제 #2
0
    def list_outputs(self, args, screen_info=None):
        """Command handler for inputs.

    Show inputs to 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 lines as a RichTextLines object.
    """

        # Screen info not currently used by this handler. Include this line to
        # mute pylint.
        _ = screen_info
        # TODO(cais): Use screen info to format the output lines more prettily,
        # e.g., hanging indent of long node names.

        parsed = self._arg_parsers["list_outputs"].parse_args(args)

        output = self._list_inputs_or_outputs(parsed.recursive,
                                              parsed.node_name,
                                              parsed.depth,
                                              parsed.control,
                                              parsed.op_type,
                                              do_outputs=True)

        node_name = debug_data.get_node_name(parsed.node_name)
        _add_main_menu(output, node_name=node_name, enable_list_outputs=False)

        return output
예제 #3
0
    def _prepare_cont_call_dump_path_and_run_options(self):
        """Prepare the dump path and RunOptions for next cont() call.

    Returns:
      dump_path: (str) Directory path to which the intermediate tensor will be
        dumped.
      run_options: (config_pb2.RunOptions) The RunOptions containing the tensor
        watch options for this graph.
    """
        run_options = config_pb2.RunOptions()
        dump_path = self._cont_call_dump_path()
        for element_name in self._closure_elements:
            if ":" in element_name:
                debug_utils.add_debug_tensor_watch(
                    run_options,
                    debug_data.get_node_name(element_name),
                    output_slot=debug_data.get_output_slot(element_name),
                    debug_urls=["file://" + dump_path])

        return dump_path, run_options
예제 #4
0
  def _prepare_cont_call_dump_path_and_run_options(self):
    """Prepare the dump path and RunOptions for next cont() call.

    Returns:
      dump_path: (str) Directory path to which the intermediate tensor will be
        dumped.
      run_options: (config_pb2.RunOptions) The RunOptions containing the tensor
        watch options for this graph.
    """
    run_options = config_pb2.RunOptions()
    dump_path = self._cont_call_dump_path()
    for element_name in self._closure_elements:
      if ":" in element_name:
        debug_utils.add_debug_tensor_watch(
            run_options,
            debug_data.get_node_name(element_name),
            output_slot=debug_data.get_output_slot(element_name),
            debug_urls=["file://" + dump_path])

    return dump_path, run_options
예제 #5
0
 def testParseNodeNameInputWorks(self):
     self.assertEqual("a", debug_data.get_node_name("a"))
     self.assertEqual(0, debug_data.get_output_slot("a"))
예제 #6
0
    def testParseTensorNameInputWorks(self):
        self.assertEqual("a", debug_data.get_node_name("a:0"))
        self.assertEqual(0, debug_data.get_output_slot("a:0"))

        self.assertEqual("_b", debug_data.get_node_name("_b:1"))
        self.assertEqual(1, debug_data.get_output_slot("_b:1"))
예제 #7
0
 def testParseNodeNameInputWorks(self):
   self.assertEqual("a", debug_data.get_node_name("a"))
   self.assertEqual(0, debug_data.get_output_slot("a"))
예제 #8
0
  def testParseTensorNameInputWorks(self):
    self.assertEqual("a", debug_data.get_node_name("a:0"))
    self.assertEqual(0, debug_data.get_output_slot("a:0"))

    self.assertEqual("_b", debug_data.get_node_name("_b:1"))
    self.assertEqual(1, debug_data.get_output_slot("_b:1"))