class_docstr: Create a hook on `m` with `hook_func`.
class_docstr_tok: ["Create","a","hook","on","`","m","`","with","`","hook_func","`","."]
docstr: Applies `hook_func` to `module`, `input`, `output`.
code: def hook_fn(self, module, input, output):
      "Applies `hook_func` to `module`, `input`, `output`."
      if self.detach:
          input = (
              (o.detach() for o in input)
              if is_listy(input)
              else input.detach()
          )
          output = (
              (o.detach() for o in output)
              if is_listy(output)
              else output.detach()
          )
      self.stored = self.hook_func(module, input, output)
  
imports: import base64
  import os
  import sys
  import cv2
  import numpy
  import paddle
  import paddle.nn
  from PIL import Image
label_desc: Use image node_id 2 for calling the Hook obj's underlying member method code with example usage: obj.hook_fn(module, input, output) without return types