class_docstr: Trainer extension to report parameter statistics.
  
  Statistics are collected and reported for a given :class:`~chainer.Link`
  or an iterable of :class:`~chainer.Link`\ s. If a link contains child
  links, the statistics are reported separately for each child.
  
  Any function that takes a one-dimensional :class:`numpy.ndarray` or a
  :class:`cupy.ndarray` and outputs a single or multiple real numbers can be
  registered to handle the collection of statistics, e.g.
  :meth:`numpy.ndarray.mean`.
  
  The keys of reported statistics follow the convention of link name
  followed by parameter name, attribute name and function name, e.g.
  ``VGG16Layers/conv1_1/W/data/mean``. They are prepended with an optional
  prefix and appended with integer indices if the statistics generating
  function return multiple values.
  
  Args:
      links (~chainer.Link or iterable of ~chainer.Link): Link(s) containing
          the parameters to observe. The link is expected to have a ``name``
          attribute which is used as a part of the report key.
      statistics (dict or 'default'): Dictionary with function name to
          function mappings.
          The name is a string and is used as a part of the report key. The
          function is responsible for generating the statistics.
          If the special value ``'default'`` is specified, the default
          statistics functions will be used.
      report_params (bool): If ``True``, report statistics for parameter
          values such as weights and biases.
      report_grads (bool): If ``True``, report statistics for parameter
          gradients.
      prefix (str): Optional prefix to prepend to the report keys.
      trigger: Trigger that decides when to aggregate the results and report
          the values.
      skip_nan_params (bool): If ``True``, statistics are not computed for
          parameters including NaNs and a single NaN value is immediately
          reported instead. Otherwise, this extension will simply try to
          compute the statistics without performing any checks for NaNs.
  
  .. note::
  
     The default statistic functions are as follows:
  
     * ``'mean'`` (``xp.mean(x)``)
     * ``'std'`` (``xp.std(x)``)
     * ``'min'`` (``xp.min(x)``)
     * ``'max'`` (``xp.max(x)``)
     * ``'zeros'`` (``xp.count_nonzero(x == 0)``)
     * ``'percentile'`` (``xp.percentile(x, (0.13, 2.28, 15.87, 50, 84.13, 97.72, 99.87))``)
docstr: Register a function to compute a certain statistic.
  
  The registered function will be called each time the extension runs and
  the results will be included in the report.
  
  Args:
      name (str): Name of the statistic.
      function: Function to generate the statistic. Any function that
          takes a one-dimensional :class:`numpy.ndarray` or a
          :class:`cupy.ndarray` and outputs a single or multiple real
          numbers is allowed.
code: def register_statistics(self, name, function):
      """Register a function to compute a certain statistic.
  
      The registered function will be called each time the extension runs and
      the results will be included in the report.
  
      Args:
          name (str): Name of the statistic.
          function: Function to generate the statistic. Any function that
              takes a one-dimensional :class:`numpy.ndarray` or a
              :class:`cupy.ndarray` and outputs a single or multiple real
              numbers is allowed.
      """
      self._statistics[name] = function
  
file_path: chainer/chainer/training/extensions/parameter_statistics.py
imports: import numpy
  import six
  import chainer
  from chainer import backend
  from chainer import reporter
  from chainer.training import extension
  from chainer.training import trigger
label_desc: Use image node_id 3 for calling the ParameterStatistics obj's underlying member method code with example usage: obj.register_statistics(name, function) without return types