MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / list_tensors

Method list_tensors

tensorflow/python/debug/cli/analyzer_cli.py:481–598  ·  view source on GitHub ↗

Command handler for list_tensors. List tensors dumped during debugged Session.run() call. 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. Return

(self, args, screen_info=None)

Source from the content-addressed store, hash-verified

479 return self._arg_parsers[handler_name].format_help()
480
481 def list_tensors(self, args, screen_info=None):
482 """Command handler for list_tensors.
483
484 List tensors dumped during debugged Session.run() call.
485
486 Args:
487 args: Command-line arguments, excluding the command prefix, as a list of
488 str.
489 screen_info: Optional dict input containing screen information such as
490 cols.
491
492 Returns:
493 Output text lines as a RichTextLines object.
494
495 Raises:
496 ValueError: If `--filter_exclude_node_names` is used without `-f` or
497 `--tensor_filter` being used.
498 """
499
500 # TODO(cais): Add annotations of substrings for dumped tensor names, to
501 # facilitate on-screen highlighting/selection of node names.
502 _ = screen_info
503
504 parsed = self._arg_parsers["list_tensors"].parse_args(args)
505
506 output = []
507
508 filter_strs = []
509 if parsed.op_type_filter:
510 op_type_regex = re.compile(parsed.op_type_filter)
511 filter_strs.append("Op type regex filter: \"%s\"" % parsed.op_type_filter)
512 else:
513 op_type_regex = None
514
515 if parsed.node_name_filter:
516 node_name_regex = re.compile(parsed.node_name_filter)
517 filter_strs.append("Node name regex filter: \"%s\"" %
518 parsed.node_name_filter)
519 else:
520 node_name_regex = None
521
522 output = debugger_cli_common.RichTextLines(filter_strs)
523 output.append("")
524
525 if parsed.tensor_filter:
526 try:
527 filter_callable = self.get_tensor_filter(parsed.tensor_filter)
528 except ValueError:
529 output = cli_shared.error("There is no tensor filter named \"%s\"." %
530 parsed.tensor_filter)
531 _add_main_menu(output, node_name=None, enable_list_tensors=False)
532 return output
533
534 data_to_show = self._debug_dump.find(
535 filter_callable,
536 exclude_node_names=parsed.filter_exclude_node_names)
537 else:
538 if parsed.filter_exclude_node_names:

Callers

nothing calls this directly

Calls 15

appendMethod · 0.95
get_tensor_filterMethod · 0.95
_sort_dump_data_byMethod · 0.95
extendMethod · 0.95
prependMethod · 0.95
_add_main_menuFunction · 0.85
parse_argsMethod · 0.80
errorMethod · 0.80
node_op_typeMethod · 0.80
compileMethod · 0.45

Tested by

no test coverage detected