class_docstr: :class:`~opacus.optimizers.optimizer.DPOptimizer` that implements
  per layer clipping strategy and is compatible with distributed data parallel
class_docstr_tok: [":","class",":","`","~opacus.optimizers.optimizer.DPOptimizer","`","that","implements","per","layer","clipping","strategy","and","is","compatible","with","distributed","data","parallel"]
code: def _scale_grad_parameter(self, p: nn.Parameter):
      if not hasattr(p, "accumulated_iterations"):
          p.accumulated_iterations = 0
      p.accumulated_iterations += 1
      if self.loss_reduction == "mean":
          p.grad /= (
              self.expected_batch_size
              * p.accumulated_iterations
              * self.world_size
          )
  
imports: from __future__ import annotations
  from functools import partial
  from typing import Callable, List, Optional
  import torch
  from opt_einsum import contract
  from torch import nn
  from torch.optim import Optimizer
  from .ddpoptimizer import DistributedDPOptimizer
  from .optimizer import DPOptimizer, _generate_noise
  from .perlayeroptimizer import DPPerLayerOptimizer
label_desc: Use image node_id 4 for calling the DistributedPerLayerOptimizer obj's underlying member method code with example usage: obj._scale_grad_parameter(p) without return types