code: def test_supports_structured_elems_complex(self):
      data = self.evaluate(
          uniform.Uniform(-1.0, 1.0).sample(
              2**4, seed=test_util.test_seed()
          )
      )
      mean_, variance_ = self.evaluate(
          (tf.reduce_mean(data), tf.math.reduce_variance(data))
      )
  
      # Compute means and variances in a single pass by merging local statistics.
      accumulated_stats = collections.namedtuple(
          "accumulated_stats", ("count", "mean", "unscaled_variance")
      )
  
      def fn(a, b):
          total_count = a.count + b.count
          return accumulated_stats(
              count=total_count,
              mean=(a.count * a.mean + b.count * b.mean) / total_count,
              unscaled_variance=(
                  a.unscaled_variance
                  + b.unscaled_variance
                  + (b.mean - a.mean) ** 2
                  * a.count
                  * b.count
                  / total_count
              ),
          )
  
      initial_stats = accumulated_stats(
          count=self._maybe_static(tf.ones_like(data)),
          mean=self._maybe_static(data),
          unscaled_variance=self._maybe_static(tf.zeros_like(data)),
      )
      result = self.evaluate(
          scan_associative(fn, elems=initial_stats, max_num_levels=8)
      )
      self.assertAllClose(mean_, result.mean[-1])
      self.assertAllClose(
          variance_, result.unscaled_variance[-1] / result.count[-1]
      )
  
imports: import collections
  import functools
  import operator
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import uniform
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.math.scan_associative import scan_associative
label_desc: Use image node_id 8 for calling the _ScanAssociativeTest obj's underlying member method code with example usage: obj.test_supports_structured_elems_complex() and returns: accumulated_stats