class_docstr: A hook that contains callbacks to be executed just before and after the forward method of a model. The difference
  with PyTorch existing hooks is that they get passed along the kwargs.
  
  Class attribute:
  - **no_grad** (`bool`, *optional*, defaults to `False`) -- Whether or not to execute the actual forward pass under
    the `torch.no_grad()` context manager.
docstr: To be executed just before the forward method of the model.
  
  Args:
      module (`torch.nn.Module`): The module whose forward pass will be executed just after this event.
      args (`Tuple[Any]`): The positional arguments passed to the module.
      kwargs (`Dict[Str, Any]`): The keyword arguments passed to the module.
  
  Returns:
      `Tuple[Tuple[Any], Dict[Str, Any]]`: A tuple with the treated `args` and `kwargs`.
docstr_tok: ["To","be","executed","just","before","the","forward","method","of","the","model",".","Args",":","module","(","`","torch.nn.Module","`",")",":","The","module","whose","forward","pass","will","be","executed","just","after","this","event",".","args","(","`","Tuple","[","Any","]","`",")",":","The","positional","arguments","passed","to","the","module",".","kwargs","(","`","Dict","[","Str",",","Any","]","`",")",":","The","keyword","arguments","passed","to","the","module",".","Returns",":","`","Tuple","[","Tuple","[","Any","]",",","Dict","[","Str",",","Any","]","]","`",":","A","tuple","with","the","treated","`","args","`","and","`","kwargs","`","."]
code: def pre_forward(self, module, *args, **kwargs):
      """
      To be executed just before the forward method of the model.
  
      Args:
          module (`torch.nn.Module`): The module whose forward pass will be executed just after this event.
          args (`Tuple[Any]`): The positional arguments passed to the module.
          kwargs (`Dict[Str, Any]`): The keyword arguments passed to the module.
  
      Returns:
          `Tuple[Tuple[Any], Dict[Str, Any]]`: A tuple with the treated `args` and `kwargs`.
      """
      return args, kwargs
  
imports: import functools
  from typing import Dict, List, Mapping, Optional, Union
  import torch
  import torch.nn
  from .state import PartialState
  from .utils import PrefixedDataset, find_device, named_module_tensors, send_to_device, set_module_tensor_to_device
  from .utils.modeling import get_non_persistent_buffers
label_desc: Use image node_id 2 for calling the ModelHook obj's underlying member method code with example usage: obj.pre_forward(module) and returns: args,  kwargs