class_docstr: Context Manager that interpolates exceptions received by AtomicFunction.
class_docstr_tok: ["Context","Manager","that","interpolates","exceptions","received","by","AtomicFunction","."]
docstr: Uses the GraphDebugInfo to generate an error message.
docstr_tok: ["Uses","the","GraphDebugInfo","to","generate","an","error","message","."]
code: def interpolate(self, message, node_names, graph_debug_info):
      """Uses the GraphDebugInfo to generate an error message."""
      error_message = ["Graph execution error:", ""]
      traces = tf_stack.LoadTracesFromDebugInfo(graph_debug_info)
  
      for node_name in node_names:
          error_message.append(
              f"Detected at node {node_name} defined at (most recent call last):"
          )
          if node_name in traces:
              stack_trace = traces[node_name]
              for formatted_frame in traceback.format_list(stack_trace):
                  if not any(
                      p in formatted_frame
                      for p in self.DENY_LIST_PHRASES
                  ):
                      error_message.append(formatted_frame)
          else:
              error_message.append("<stack traces unavailable>")
  
      error_message.append(message.strip())
      return "\n".join(error_message)
  
imports: import dataclasses
  import traceback
  import typing
  from typing import Any, Dict, List, Optional, Sequence, Union
  from tensorflow.core.framework import attr_value_pb2
  from tensorflow.core.framework import function_pb2
  from tensorflow.core.framework import graph_debug_info_pb2
  from tensorflow.core.function.polymorphism import function_type
  from tensorflow.python.client import pywrap_tf_session
  from tensorflow.python.eager import context
  from tensorflow.python.eager import record
  from tensorflow.python.eager.polymorphic_function import attributes
  from tensorflow.python.eager.polymorphic_function import function_type_utils
  from tensorflow.python.framework import auto_control_deps_utils
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import error_interpolation
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import func_graph
  from tensorflow.python.framework import function_def_to_graph
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import handle_data_util
  from tensorflow.python.types import core
  from tensorflow.python.util import compat
  from tensorflow.python.util import function_utils
  from tensorflow.python.util import tf_stack
label_desc: Use image node_id 2 for calling the InterpolateRuntimeError obj's underlying member method code with example usage: obj.interpolate(message, node_names, graph_debug_info) and returns: str