code: def _count_params(weights):
      """Count the total number of scalars composing the weights.
  
      Args:
          weights: An iterable containing the weights on which to compute params
  
      Returns:
          The total number of scalars composing the weights
      """
      unique_weights = {id(w): w for w in weights}.values()
      # Ignore TrackableWeightHandlers, which will not have a shape defined.
      unique_weights = [
          w for w in unique_weights if hasattr(w, "shape")
      ]
      weight_shapes = [w.shape.as_list() for w in unique_weights]
      standardized_weight_shapes = [
          [0 if w_i is None else w_i for w_i in w]
          for w in weight_shapes
      ]
      return int(sum(np.prod(p) for p in standardized_weight_shapes))
  
file_path: agents/tf_agents/networks/layer_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import re
  import numpy
  import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: _count_params(weights) and returns: int