class_docstr: Base class of debug-wrapper session classes.
  
  Concrete classes that inherit from this class need to implement the abstract
  methods such as on_session_init, on_run_start and on_run_end.
class_docstr_tok: ["Base","class","of","debug-wrapper","session","classes",".","Concrete","classes","that","inherit","from","this","class","need","to","implement","the","abstract","methods","such","as","on_session_init",",","on_run_start","and","on_run_end","."]
docstr: Constructor of `BaseDebugWrapperSession`.
  
  Args:
    sess: An (unwrapped) TensorFlow session instance. It should be a subtype
      of `BaseSession` or `tf.MonitoredSession`.
    thread_name_filter: Regular-expression filter (allowlist) for name(s) of
      thread(s) on which the wrapper session will be active. This regular
      expression is used in a start-anchored fashion on the thread name, i.e.,
      by applying the `match` method of the compiled pattern. The default
      `None` means that the wrapper session will be active on all threads.
      E.g., r"MainThread$", r"QueueRunnerThread.*".
    pass_through_operrors: If True, all captured OpErrors will be
      propagated.  By default this captures all OpErrors.
  
  Raises:
    ValueError: On invalid `OnSessionInitAction` value.
    NotImplementedError: If a non-DirectSession sess object is received.
docstr_tok: ["Constructor","of","`","BaseDebugWrapperSession","`",".","Args",":","sess",":","An","(","unwrapped",")","TensorFlow","session","instance",".","It","should","be","a","subtype","of","`","BaseSession","`","or","`","tf.MonitoredSession","`",".","thread_name_filter",":","Regular-expression","filter","(","allowlist",")","for","name","(","s",")","of","thread","(","s",")","on","which","the","wrapper","session","will","be","active",".","This","regular","expression","is","used","in","a","start-anchored","fashion","on","the","thread","name",",","i.e.",",","by","applying","the","`","match","`","method","of","the","compiled","pattern",".","The","default","`","None","`","means","that","the","wrapper","session","will","be","active","on","all","threads",".","E.g.",",","r","''","MainThread","$","''",",","r","''","QueueRunnerThread.","*","''",".","pass_through_operrors",":","If","True",",","all","captured","OpErrors","will","be","propagated",".","By","default","this","captures","all","OpErrors",".","Raises",":","ValueError",":","On","invalid","`","OnSessionInitAction","`","value",".","NotImplementedError",":","If","a","non-DirectSession","sess","object","is","received","."]
code: def __init__(
      self, sess, thread_name_filter=None, pass_through_operrors=False
  ):
      """Constructor of `BaseDebugWrapperSession`.
  
      Args:
        sess: An (unwrapped) TensorFlow session instance. It should be a subtype
          of `BaseSession` or `tf.MonitoredSession`.
        thread_name_filter: Regular-expression filter (allowlist) for name(s) of
          thread(s) on which the wrapper session will be active. This regular
          expression is used in a start-anchored fashion on the thread name, i.e.,
          by applying the `match` method of the compiled pattern. The default
          `None` means that the wrapper session will be active on all threads.
          E.g., r"MainThread$", r"QueueRunnerThread.*".
        pass_through_operrors: If True, all captured OpErrors will be
          propagated.  By default this captures all OpErrors.
  
      Raises:
        ValueError: On invalid `OnSessionInitAction` value.
        NotImplementedError: If a non-DirectSession sess object is received.
      """
  
      _check_type(
          sess,
          (session.BaseSession, monitored_session.MonitoredSession),
      )
  
      # The session being wrapped.
      self._sess = sess
      self._thread_name_filter_pattern = (
          re.compile(thread_name_filter) if thread_name_filter else None
      )
      # TODO(cais/kstevens): Unittest this pass through feature.
      self._pass_through_operrors = pass_through_operrors
  
      # Keeps track of number of run calls that have been performed on this
      # debug-wrapper session. The count can be used for purposes such as
      # displaying the state of the Session in a UI and determining a run
      # number-dependent debug URL.
      self._run_call_count = 0
  
      # Invoke on-session-init callback.
      response = self.on_session_init(OnSessionInitRequest(self._sess))
      _check_type(response, OnSessionInitResponse)
  
      if response.action == OnSessionInitAction.PROCEED:
          pass
      elif response.action == OnSessionInitAction.REMOTE_INSTR_LOOP:
          # TODO(cais): Implement REMOTE_INSTR_LOOP
          raise NotImplementedError(
              "OnSessionInitAction REMOTE_INSTR_LOOP has not been "
              "implemented."
          )
      else:
          raise ValueError(
              "Invalid OnSessionInitAction value: %s" % response.action
          )
  
      self._default_session_context_manager = None
  
      # A cache for callables created from CallableOptions.
      self._cached_callables_from_options = {}
  
imports: import abc
  import re
  import threading
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.python.client import session
  from tensorflow.python.debug.lib import debug_utils
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import stack
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.training import monitored_session
  from tensorflow.python.util import nest
  from tensorflow.python.util.compat import collections_abc
label_desc: Use image node_id 1 to create a new BaseDebugWrapperSession object from inherited base classes: session with example: obj = BaseDebugWrapperSession(sess, thread_name_filter, pass_through_operrors)