code: def _compute_norms(self, grad_scale=1.0):
      grad_norm = 0.0
      param_norm = 0.0
      for p in self.master_params:
          with th.no_grad():
              param_norm += (
                  th.norm(p, p=2, dtype=th.float32).item() ** 2
              )
              if p.grad is not None:
                  grad_norm += (
                      th.norm(p.grad, p=2, dtype=th.float32).item() ** 2
                  )
      return np.sqrt(grad_norm) / grad_scale, np.sqrt(param_norm)
  
imports: import numpy
  import torch
  import torch.nn
  from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
  from .None import logger
label_desc: Use image node_id 7 for calling the MixedPrecisionTrainer obj's underlying member method code with example usage: obj._compute_norms(grad_scale) and returns: unknown,  np