class_docstr: Extends nn.Module so that its parameter tensors have an extra field called .grad_sample.
class_docstr_tok: ["Extends","nn.Module","so","that","its","parameter","tensors","have","an","extra","field","called",".grad_sample","."]
docstr: Sets a flag to detect gradient accumulation (multiple forward/backward passes
  without an optimizer step or clearing out gradients).
  
  When set, GradSampleModule will throw a ValueError on the second backward pass.
  :return:
docstr_tok: ["Sets","a","flag","to","detect","gradient","accumulation","(","multiple","forward\/backward","passes","without","an","optimizer","step","or","clearing","out","gradients",")",".","When","set",",","GradSampleModule","will","throw","a","ValueError","on","the","second","backward","pass",".",":","return",":"]
code: def forbid_grad_accumulation(self):
      """
      Sets a flag to detect gradient accumulation (multiple forward/backward passes
      without an optimizer step or clearing out gradients).
  
      When set, GradSampleModule will throw a ValueError on the second backward pass.
      :return:
      """
      pass
  
imports: import logging
  from abc import ABC, abstractmethod
  from typing import Optional
  import torch.nn
  from opacus.utils.module_utils import trainable_parameters
  from torch.utils.hooks import RemovableHandle
label_desc: Use image node_id 11 for calling the AbstractGradSampleModule obj's underlying member method code with example usage: obj.forbid_grad_accumulation() without return types