code: def count_params(layer, **tags):
      """
      This function counts all parameters (i.e., the number of scalar
      values) of all layers below one or more given :class:`Layer` instances,
      including the layer(s) itself.
  
      This is useful to compare the capacity of various network architectures.
      All parameters returned by the :class:`Layer`s' `get_params` methods are
      counted.
  
      Parameters
      ----------
      layer : Layer or list
          The :class:`Layer` instance for which to count the parameters, or a
          list of :class:`Layer` instances.
  
      **tags (optional)
          tags can be specified to filter the list of parameter variables that
          will be included in the count. Specifying ``tag1=True``
          will limit the list to parameters that are tagged with ``tag1``.
          Specifying ``tag1=False`` will limit the list to parameters that
          are not tagged with ``tag1``. Commonly used tags are
          ``regularizable`` and ``trainable``.
  
      Returns
      -------
      int
          The total number of learnable parameters.
  
      Examples
      --------
      >>> from lasagne.layers import InputLayer, DenseLayer
      >>> l_in = InputLayer((100, 20))
      >>> l1 = DenseLayer(l_in, num_units=50)
      >>> param_count = count_params(l1)
      >>> param_count
      1050
      >>> param_count == 20 * 50 + 50  # 20 input * 50 units + 50 biases
      True
      """
      params = get_all_params(layer, **tags)
      shapes = [p.get_value().shape for p in params]
      counts = [np.prod(shape) for shape in shapes]
      return sum(counts)
  
file_path: Lasagne/lasagne/layers/helper.py
imports: from collections import deque
  from difflib import get_close_matches
  from itertools import chain
  from warnings import warn
  import theano
  import numpy
  from ..None import utils
label_desc: Use image node_id 5 for calling a global function with example usage: count_params(layer) and returns: sum