code: def model_params_stats(
      model, param_dims=[2, 4], param_types=["weight", "bias"]
  ):
      """Returns the model sparsity, weights count, and the count of weights in the sparse model.
  
      Returns:
          model_sparsity - the model weights sparsity (in percent)
          params_cnt - the number of weights in the entire model (incl. zeros)
          params_nnz_cnt - the number of weights in the entire model, excluding zeros.
                           nnz stands for non-zeros.
      """
      params_cnt = 0
      params_nnz_cnt = 0
      for name, param in model.state_dict().items():
          if param.dim() in param_dims and any(
              type in name for type in param_types
          ):
              _density = density(param)
              params_cnt += torch.numel(param)
              params_nnz_cnt += param.numel() * _density
      model_sparsity = (1 - params_nnz_cnt / params_cnt) * 100
      return model_sparsity, params_cnt, params_nnz_cnt
  
imports: import argparse
  from collections import OrderedDict
  from copy import deepcopy
  import logging
  import operator
  import random
  import numpy
  import torch
  import torch.nn
  import torch.backends.cudnn
  import yaml
  import inspect
label_desc: Use image node_id 29 for calling a global function with example usage: model_params_stats(model, param_dims, param_types) and returns: model_sparsity,  params_cnt,  params_nnz_cnt