class_docstr: ## Zero3 Layer
  
  Each layer of the model (or a combination of a few consecutive layers) should be wrapped in
  this module.
class_docstr_tok: ["#","#","Zero3","Layer","Each","layer","of","the","model","(","or","a","combination","of","a","few","consecutive","layers",")","should","be","wrapped","in","this","module","."]
docstr: #### Handle a backward event
  
  This gets called by parameter backward hooks and the module backward hook.
docstr_tok: ["#","#","#","#","Handle","a","backward","event","This","gets","called","by","parameter","backward","hooks","and","the","module","backward","hook","."]
code: def _backward_event(self):
      """
      #### Handle a backward event
  
      This gets called by parameter backward hooks and the module backward hook.
      """
  
      # Decrement the hooks counter
      self._backward_hook_handles -= 1
  
      # If all the hooks (including the module hook) have been called,
      # then we can back up gradients and clean up the parameters.
      if self._backward_hook_handles == -1:
          self._backup_grads()
          self._cleanup_params()
  
      # Start fetch parameters of the previous layer, because autograd will next process the gradients of it.
      for layer in self.prev_layer:
          layer.fetch_params()
  
imports: import functools
  from typing import List, Optional, Tuple
  import torch
  import torch.distributed
  from torch import nn
label_desc: Use image node_id 9 for calling the Zero3Layer obj's underlying member method code with example usage: obj._backward_event() without return types