code: def model_info(model, verbose=False):
      # Plots a line-by-line description of a PyTorch model
      n_p = sum(
          x.numel() for x in model.parameters()
      )  # number parameters
      n_g = sum(
          x.numel() for x in model.parameters() if x.requires_grad
      )  # number gradients
      if verbose:
          print(
              "%5s %40s %9s %12s %20s %10s %10s"
              % (
                  "layer",
                  "name",
                  "gradient",
                  "parameters",
                  "shape",
                  "mu",
                  "sigma",
              )
          )
          for i, (name, p) in enumerate(model.named_parameters()):
              name = name.replace("module_list.", "")
              print(
                  "%5g %40s %9s %12g %20s %10.3g %10.3g"
                  % (
                      i,
                      name,
                      p.requires_grad,
                      p.numel(),
                      list(p.shape),
                      p.mean(),
                      p.std(),
                  )
              )
  
      try:  # FLOPS
          from thop import profile
  
          macs, _ = profile(
              model,
              inputs=(torch.zeros(1, 3, 480, 640),),
              verbose=False,
          )
          fs = ", %.1f GFLOPS" % (macs / 1e9 * 2)
      except:
          fs = ""
  
      print(
          "Model Summary: %g layers, %g parameters, %g gradients%s"
          % (len(list(model.parameters())), n_p, n_g, fs)
      )
  
file_path: deep-learning-for-image-processing/pytorch_object_detection/yolov3_spp/build_utils/torch_utils.py
imports: import math
  import time
  from copy import deepcopy
  import torch
  import torch.backends.cudnn
  import torch.nn
label_desc: Use image node_id 4 for calling a global function with example usage: model_info(model, verbose) without return types