docstr: Add handles to all non-container layers in the model.
  Recursively for non-container layers
docstr_tok: ["Add","handles","to","all","non-container","layers","in","the","model",".","Recursively","for","non-container","layers"]
code: def add_handles(self, model, forward_handle, backward_handle):
      """
      Add handles to all non-container layers in the model.
      Recursively for non-container layers
      """
      handles_list = []
      model_children = list(model.children())
      if model_children:
          for child in model_children:
              handles_list.extend(
                  self.add_handles(
                      child, forward_handle, backward_handle
                  )
              )
      else:  # leaves
          handles_list.append(
              model.register_forward_hook(forward_handle)
          )
          handles_list.append(
              model.register_full_backward_hook(backward_handle)
          )
      return handles_list
  
file_path: shap/shap/explainers/_deep/deep_pytorch.py
imports: import warnings
  import numpy
  from packaging import version
  from .._explainer import Explainer
  from .deep_utils import _check_additivity
label_desc: Use image node_id 3 for calling the PyTorchDeep obj's underlying member method code with example usage: obj.add_handles(model, forward_handle, backward_handle) and returns: handles_list