docstr: Tests functionality with a general, composite `Encoder`.
docstr_tok: ["Tests","functionality","with","a","general",",","composite","`","Encoder","`","."]
code: def test_composite_encoder(self):
      """Tests functionality with a general, composite `Encoder`."""
      x = tf.constant(1.2)
      encoder = core_encoder.EncoderComposer(
          test_utils.SignIntFloatEncodingStage()
      )
      encoder.add_child(test_utils.TimesTwoEncodingStage(), SIF_SIGNS)
      encoder.add_child(test_utils.PlusOneEncodingStage(), SIF_INTS)
      encoder.add_child(
          test_utils.TimesTwoEncodingStage(), SIF_FLOATS
      ).add_child(test_utils.PlusOneOverNEncodingStage(), T2_VALS)
      encoder = simple_encoder.SimpleEncoder(
          encoder.make(), tf.TensorSpec.from_tensor(x)
      )
  
      state = encoder.initial_state()
      iteration = _make_iteration_function(encoder)
      for i in range(1, 10):
          x, encoded_x, decoded_x, state = self.evaluate(
              iteration(x, state)
          )
          self.assertAllClose(x, decoded_x)
          self.assertAllClose(
              2.0,
              _encoded_x_field(
                  encoded_x, [TENSORS, SIF_SIGNS, T2_VALS]
              ),
          )
          self.assertAllClose(
              2.0,
              _encoded_x_field(encoded_x, [TENSORS, SIF_INTS, P1_VALS]),
          )
          self.assertAllClose(
              0.4 + 1 / i,
              _encoded_x_field(
                  encoded_x, [TENSORS, SIF_FLOATS, T2_VALS, PN_VALS]
              ),
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  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 simple_encoder
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.testing import test_utils
label_desc: Use image node_id 2 for calling the SimpleEncoderTest obj's underlying member method code with example usage: obj.test_composite_encoder() without return types