code: def average_sqr_grad(
      p, sqr_mom, dampening=True, sqr_avg=None, **kwargs
  ):
      if sqr_avg is None:
          sqr_avg = torch.zeros_like(p.grad.data)
      damp = 1 - sqr_mom if dampening else 1.0
      sqr_avg.mul_(sqr_mom).addcmul_(
          p.grad.data, p.grad.data, value=damp
      )
      return {"sqr_avg": sqr_avg}
  
imports: from __future__ import annotations
  from .torch_basics import *
label_desc: Use image node_id 6 for calling a global function with example usage: average_sqr_grad(p, sqr_mom, dampening, sqr_avg) and returns: dict