class_docstr: Hooks-based implementation of AbstractGradSampleModule
  
  Computes per-sample gradients using custom-written methods for each layer.
  See README.md for more details
docstr: Globally disable all hooks installed by this library.
  Why is this needed? As per https://github.com/pytorch/pytorch/issues/25723, there is
  a bug in Autograd that makes removing hooks do nothing if the graph was already
  constructed. For this reason, we have this method to at least turn them off.
docstr_tok: ["Globally","disable","all","hooks","installed","by","this","library",".","Why","is","this","needed","?","As","per","https",":","\/\/github.com\/pytorch\/pytorch\/issues\/25723",",","there","is","a","bug","in","Autograd","that","makes","removing","hooks","do","nothing","if","the","graph","was","already","constructed",".","For","this","reason",",","we","have","this","method","to","at","least","turn","them","off","."]
code: def disable_hooks(self) -> None:
      r"""
      Globally disable all hooks installed by this library.
      Why is this needed? As per https://github.com/pytorch/pytorch/issues/25723, there is
      a bug in Autograd that makes removing hooks do nothing if the graph was already
      constructed. For this reason, we have this method to at least turn them off.
      """
      self.hooks_enabled = False
  
imports: from __future__ import annotations
  import logging
  import warnings
  from functools import partial
  from typing import Iterable, List, Tuple
  import torch
  import torch.nn
  from opacus.grad_sample.functorch import ft_compute_per_sample_gradient, prepare_layer
  from opacus.grad_sample.gsm_base import AbstractGradSampleModule
  from opacus.layers.dp_rnn import DPGRU, DPLSTM, DPRNN, RNNLinear
  from opacus.utils.module_utils import has_trainable_params, requires_grad, trainable_modules, trainable_parameters
label_desc: Use image node_id 6 for calling the GradSampleModule obj's underlying member method code with example usage: obj.disable_hooks() without return types