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

Function get_error_intro

tensorflow/python/debug/cli/cli_shared.py:434–493  ·  view source on GitHub ↗

Generate formatted intro for TensorFlow run-time error. Args: tf_error: (errors.OpError) TensorFlow run-time error object. Returns: (RichTextLines) Formatted intro message about the run-time OpError, with sample commands for debugging.

(tf_error)

Source from the content-addressed store, hash-verified

432
433
434def get_error_intro(tf_error):
435 """Generate formatted intro for TensorFlow run-time error.
436
437 Args:
438 tf_error: (errors.OpError) TensorFlow run-time error object.
439
440 Returns:
441 (RichTextLines) Formatted intro message about the run-time OpError, with
442 sample commands for debugging.
443 """
444
445 if hasattr(tf_error, "op") and hasattr(tf_error.op, "name"):
446 op_name = tf_error.op.name
447 else:
448 op_name = None
449
450 intro_lines = [
451 "--------------------------------------",
452 RL("!!! An error occurred during the run !!!", "blink"),
453 "",
454 ]
455
456 out = debugger_cli_common.rich_text_lines_from_rich_line_list(intro_lines)
457
458 if op_name is not None:
459 out.extend(debugger_cli_common.RichTextLines(
460 ["You may use the following commands to debug:"]))
461 out.extend(
462 _recommend_command("ni -a -d -t %s" % op_name,
463 "Inspect information about the failing op.",
464 create_link=True))
465 out.extend(
466 _recommend_command("li -r %s" % op_name,
467 "List inputs to the failing op, recursively.",
468 create_link=True))
469
470 out.extend(
471 _recommend_command(
472 "lt",
473 "List all tensors dumped during the failing run() call.",
474 create_link=True))
475 else:
476 out.extend(debugger_cli_common.RichTextLines([
477 "WARNING: Cannot determine the name of the op that caused the error."]))
478
479 more_lines = [
480 "",
481 "Op name: %s" % op_name,
482 "Error type: " + str(type(tf_error)),
483 "",
484 "Details:",
485 str(tf_error),
486 "",
487 "--------------------------------------",
488 "",
489 ]
490
491 out.extend(debugger_cli_common.RichTextLines(more_lines))

Callers

nothing calls this directly

Calls 3

_recommend_commandFunction · 0.85
typeFunction · 0.85
extendMethod · 0.45

Tested by

no test coverage detected