class_docstr: Online summarization of a sequence of dictionaries.
  
  ``DictSummary`` computes the statistics of a given set of scalars online.
  It only computes the statistics for scalar values and variables of scalar
  values in the dictionaries.
class_docstr_tok: ["Online","summarization","of","a","sequence","of","dictionaries",".","``","DictSummary","``","computes","the","statistics","of","a","given","set","of","scalars","online",".","It","only","computes","the","statistics","for","scalar","values","and","variables","of","scalar","values","in","the","dictionaries","."]
docstr: Adds a dictionary of scalars.
  
  Args:
      d (dict): Dictionary of scalars to accumulate. Only elements of
         scalars, zero-dimensional arrays, and variables of
         zero-dimensional arrays are accumulated. When the value
         is a tuple, the second element is interpreted as a weight.
code: def add(self, d):
      """Adds a dictionary of scalars.
  
      Args:
          d (dict): Dictionary of scalars to accumulate. Only elements of
             scalars, zero-dimensional arrays, and variables of
             zero-dimensional arrays are accumulated. When the value
             is a tuple, the second element is interpreted as a weight.
  
      """
      summaries = self._summaries
      for k, v in six.iteritems(d):
          w = 1
          if isinstance(v, tuple):
              w = v[1]
              v = v[0]
              if isinstance(w, variable.Variable):
                  w = w.array
              if (
                  not numpy.isscalar(w)
                  and not getattr(w, "ndim", -1) == 0
              ):
                  raise ValueError(
                      "Given weight to {} was not scalar.".format(k)
                  )
          if isinstance(v, variable.Variable):
              v = v.array
          if numpy.isscalar(v) or getattr(v, "ndim", -1) == 0:
              summaries[k].add(v, weight=w)
  
imports: from __future__ import absolute_import
  import collections
  import contextlib
  import copy
  import json
  import threading
  import typing
  import warnings
  import numpy
  import six
  import chainer
  from chainer import backend
  from chainer import configuration
  from chainer import serializer
  from chainer import variable
  import chainerx
label_desc: Use image node_id 2 for calling the DictSummary obj's underlying member method code with example usage: obj.add(d) without return types