class_docstr: A general callback object that handles multiple events.
  
  This class has `on_backward`, `on_batch`, `on_epoch`, and `on_end` methods, corresponding to
  each callback type. Each one receives the state of the wrapper object as `self`.
  This enables easier state sharing between related callbacks.
  
  Also, this callback type is instantiated with `serialization_dir` and `on_start` is called
  with the trainer instance as an argument. This might be handy in case of callback logging
  and saving its own files next to the config/checkpoints/logs/etc.
docstr: This callback hook performs backpropagation and allows for gradient manipulation.
  `backward_called` indicates if `loss.backward` has been called prior to this callback.
  `on_backward` should return `True` if and only if `loss.backward` is called in its body.
docstr_tok: ["This","callback","hook","performs","backpropagation","and","allows","for","gradient","manipulation",".","`","backward_called","`","indicates","if","`","loss.backward","`","has","been","called","prior","to","this","callback",".","`","on_backward","`","should","return","`","True","`","if","and","only","if","`","loss.backward","`","is","called","in","its","body","."]
code: def on_backward(
      self,
      trainer: "GradientDescentTrainer",
      batch_outputs: Dict[str, torch.Tensor],
      backward_called: bool,
      **kwargs,
  ) -> bool:
      """
      This callback hook performs backpropagation and allows for gradient manipulation.
      `backward_called` indicates if `loss.backward` has been called prior to this callback.
      `on_backward` should return `True` if and only if `loss.backward` is called in its body.
      """
      return False
  
file_path: allennlp/allennlp/training/callbacks/callback.py
imports: from typing import List, Dict, Any, Optional, TYPE_CHECKING
  import torch
  from allennlp.common import Registrable
  from allennlp.data import TensorDict
label_desc: Use image node_id 3 for calling the TrainerCallback obj's underlying member method code with example usage: obj.on_backward(trainer, batch_outputs, backward_called) and returns: False