code: def sum_mvns(distributions):
      """Attempt to sum MultivariateNormal distributions.
  
      The sum of (multivariate) normal random variables is itself (multivariate)
      normal, with mean given by the sum of means and (co)variance given by the
      sum of (co)variances. This method exploits this fact to compute the
      sum of a list of `tfd.MultivariateNormalDiag` objects.
  
      It may in the future be extended to support summation of other forms of
      (Multivariate)Normal distributions.
  
      Args:
        distributions: Python `iterable` of `tfd.MultivariateNormalDiag`
          distribution instances. These must all have the same event
          shape, and broadcast to a consistent batch shape.
  
      Returns:
        sum_distribution: A `tfd.MultivariateNormalDiag` instance with mean
          equal to the sum of input means and covariance equal to the sum of
          input covariances.
      """
  
      with tf.name_scope("sum_mvns"):
          if all(
              [
                  isinstance(mvn, mvn_diag.MultivariateNormalDiag)
                  for mvn in distributions
              ]
          ):
              return mvn_diag.MultivariateNormalDiag(
                  loc=sum(mvn.mean() for mvn in distributions),
                  scale_diag=tf.sqrt(
                      sum(mvn.scale.diag**2 for mvn in distributions)
                  ),
              )
          else:
              raise NotImplementedError(
                  "Sums of distributions other than MultivariateNormalDiag are not "
                  "currently implemented. (given: {})".format(
                      distributions
                  )
              )
  
imports: import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import mixture_same_family
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import mvn_linear_operator
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.sts.internal import missing_values_util
label_desc: Use image node_id 5 for calling a global function with example usage: sum_mvns(distributions) and returns: mvn_diag