class_docstr: A debug mode that facilitates stepping through function execution.
  
  Its default behavior is to behave like the 'FAST_RUN' mode. By providing
  either a `pre_func` (called before a node is executed) or a `post_func`
  (called after a node is executed) monitoring function, the user can inspect
  node behavior.
  
  A typical use case is to detect the introduction of NaN values in a graph.
  For an example of such a use case, see doc/tutorial/debug_faq.txt.
  
  Parameters
  ----------
  pre_func
      A function to call before executing a thunk, with arguments:
      - the `FunctionGraph`
      - the thunk index
      - the `Apply` node
      - the thunk to be called
  post_func
      A function to call after executing a thunk, with the same arguments as
      `pre_func`.
  optimizer
      The optimizer to use. One may use for instance 'fast_compile' to skip
      optimizations.
  linker
      DO NOT USE. This mode uses its own linker. The parameter is needed to
      allow selecting optimizers to use.
class_docstr_tok: ["A","debug","mode","that","facilitates","stepping","through","function","execution",".","Its","default","behavior","is","to","behave","like","the","'FAST_RUN","'","mode",".","By","providing","either","a","`","pre_func","`","(","called","before","a","node","is","executed",")","or","a","`","post_func","`","(","called","after","a","node","is","executed",")","monitoring","function",",","the","user","can","inspect","node","behavior",".","A","typical","use","case","is","to","detect","the","introduction","of","NaN","values","in","a","graph",".","For","an","example","of","such","a","use","case",",","see","doc\/tutorial\/debug_faq.txt",".","Parameters","--","--","--","--","--","pre_func","A","function","to","call","before","executing","a","thunk",",","with","arguments",":","-","the","`","FunctionGraph","`","-","the","thunk","index","-","the","`","Apply","`","node","-","the","thunk","to","be","called","post_func","A","function","to","call","after","executing","a","thunk",",","with","the","same","arguments","as","`","pre_func","`",".","optimizer","The","optimizer","to","use",".","One","may","use","for","instance","'fast_compile","'","to","skip","optimizations",".","linker","DO","NOT","USE",".","This","mode","uses","its","own","linker",".","The","parameter","is","needed","to","allow","selecting","optimizers","to","use","."]
docstr: The method that calls the thunk `fn`.
docstr_tok: ["The","method","that","calls","the","thunk","`","fn","`","."]
code: def eval(self, fgraph, i, node, fn):
      """
      The method that calls the thunk `fn`.
  
      """
      if self.pre_func is not None:
          self.pre_func(fgraph, i, node, fn)
      fn()
      if self.post_func is not None:
          self.post_func(fgraph, i, node, fn)
  
file_path: pytensor/pytensor/compile/monitormode.py
imports: import numpy
  from pytensor.compile.mode import Mode
  from pytensor.configdefaults import config
  from pytensor.link.basic import WrapLinkerMany
  from pytensor.link.c.basic import OpWiseCLinker
label_desc: Use image node_id 4 for calling the MonitorMode obj's underlying member method code with example usage: obj.eval(fgraph, i, node, fn) without return types