docstr: Tests that all state updates tensors can be aggregated.
docstr_tok: ["Tests","that","all","state","updates","tensors","can","be","aggregated","."]
code: def test_state_aggregation_modes(self):
      """Tests that all state updates tensors can be aggregated."""
      x_fn = lambda: tf.random.uniform((5,))
      encoder = gather_encoder.GatherEncoder.from_encoder(
          core_encoder.EncoderComposer(
              test_utils.StateUpdateTensorsEncodingStage()
          ).make(),
          tf.TensorSpec.from_tensor(x_fn()),
      )
  
      iteration = _make_iteration_function(encoder, x_fn, 3)
      data = self.evaluate(iteration(encoder.initial_state()))
  
      expected_sum = np.sum(data.x)
      expected_min = np.amin(data.x)
      expected_max = np.amax(data.x)
      expected_stack_values = 15  # 3 values of shape 5.
      expected_state = [
          expected_sum,
          expected_min,
          expected_max,
          expected_stack_values,
      ]
      # We are not in control of ordering of the elements in state tuple.
      self.assertAllClose(
          sorted(expected_state), sorted(data.updated_state)
      )
  
imports: import collections
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow.python.framework import test_util
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.core import core_encoder
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.core import encoding_stage
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.core import gather_encoder
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.testing import test_utils
label_desc: Use image node_id 8 for calling the GatherEncoderTest obj's underlying member method code with example usage: obj.test_state_aggregation_modes() without return types