class_docstr: Sharpness-Aware Minimization that simultaneously minimizes loss value and loss sharpness.
  In particular, it seeks parameters that lie in neighborhoods having uniformly low loss.
code: def _grad_norm(self):
      shared_device = self.param_groups[0]["params"][
          0
      ].device  # put everything on the same device, in case of model parallelism
      norm = torch.norm(
          torch.stack(
              [
                  (
                      (torch.abs(p) if group["adaptive"] else 1.0)
                      * p.grad
                  )
                  .norm(p=2)
                  .to(shared_device)
                  for group in self.param_groups
                  for p in group["params"]
                  if p.grad is not None
              ]
          ),
          p=2,
      )
      return norm
  
file_path: towhee/towhee/models/layers/sam.py
imports: import torch
label_desc: Use image node_id 5 for calling the SAM obj's underlying member method code with example usage: obj._grad_norm() and returns: norm