code: def test_assign_log_moving_mean_exp(self):
      shape = [1, 2]
      true_mean = np.array([[0.0, 3.0]])
      true_stddev = np.array([[1.1, 0.5]])
      decay = 0.99
      log_mean_exp_var = tf.Variable(tf.zeros_like(true_mean))
      expected_var = tf.Variable(tf.zeros_like(true_mean))
      self.evaluate(
          [log_mean_exp_var.initializer, expected_var.initializer]
      )
  
      def body(it, seed):
          next_seed, current_seed = samplers.split_seed(seed)
          x = tf.random.stateless_normal(
              shape, dtype=np.float64, seed=current_seed
          )
          x = true_stddev * x + true_mean
          log_mean_exp = moving_stats.assign_log_moving_mean_exp(
              x, log_mean_exp_var, decay=decay
          )
          expected = tf.math.log(
              decay * tf.math.exp(expected_var)
              + (1 - decay) * tf.math.exp(x)
          )
          expected = expected_var.assign(expected)
          relerr = tf.abs((log_mean_exp - expected) / expected)
          op = tf.debugging.assert_less(
              relerr, np.array(1e-6, dtype=np.float64)
          )
          with tf.control_dependencies([op]):
              return [it + 1, next_seed]
  
      self.evaluate(
          tf.while_loop(
              cond=lambda it, _: it < 2000,
              body=body,
              loop_vars=[
                  0,
                  test_util.test_seed(sampler_type="stateless"),
              ],
              parallel_iterations=1,
          )
      )
  
file_path: probability/tensorflow_probability/python/stats/moving_stats_test.py
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import samplers
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.stats import moving_stats
label_desc: Use image node_id 1 for calling the MovingLogExponentialMovingMeanExpTest obj's underlying member method code with example usage: obj.test_assign_log_moving_mean_exp() and returns: list