code: def test_initialize(self, legacy_initialize):
      ema = moving_averages.ExponentialMovingAverage(0.99)
      if legacy_initialize:
          ema.initialize(jnp.ones([]))
      else:
          ema.initialize([])
      self.assertEqual(ema.average, 0.0)
      ema(jnp.array(100.0))
  
      # Matching the behavior of Sonnet 2 initialize only sets the value to zero
      # if the EMA has not already been initialized.
      if legacy_initialize:
          ema.initialize(jnp.ones([]))
      else:
          ema.initialize([])
      self.assertNotEqual(ema.average, 0.0)
  
imports: from absl.testing import absltest
  from absl.testing import parameterized
  from haiku._src import basic
  from haiku._src import moving_averages
  from haiku._src import multi_transform
  from haiku._src import test_utils
  from haiku._src import transform
  import jax
  import jax.numpy
  import jax.random
  import numpy
  import tree
label_desc: Use image node_id 9 for calling the MovingAveragesTest obj's underlying member method code with example usage: obj.test_initialize(legacy_initialize) without return types