docstr: Tests correctness of the wrapped encoding stage.
docstr_tok: ["Tests","correctness","of","the","wrapped","encoding","stage","."]
code: def test_as_adaptive_encoding_stage(self):
      """Tests correctness of the wrapped encoding stage."""
      a_var = tf.compat.v1.get_variable("a", initializer=2.0)
      b_var = tf.compat.v1.get_variable("b", initializer=3.0)
      stage = test_utils.SimpleLinearEncodingStage(a_var, b_var)
      wrapped_stage = encoding_stage.as_adaptive_encoding_stage(stage)
      self.assertIsInstance(
          wrapped_stage, encoding_stage.AdaptiveEncodingStageInterface
      )
  
      x = tf.constant(2.0)
      state = wrapped_stage.initial_state()
      encode_params, decode_params = wrapped_stage.get_params(state)
      encoded_x, state_update_tensors = wrapped_stage.encode(
          x, encode_params
      )
      updated_state = wrapped_stage.update_state(
          state, state_update_tensors
      )
      decoded_x = wrapped_stage.decode(encoded_x, decode_params)
  
      # Test that the added state functionality is empty.
      self.assertDictEqual({}, state)
      self.assertDictEqual({}, state_update_tensors)
      self.assertDictEqual({}, updated_state)
      self.assertDictEqual(
          {}, wrapped_stage.state_update_aggregation_modes
      )
      # Test that __getattr__ retrieves attributes of the wrapped stage.
      self.assertIsInstance(wrapped_stage._a, tf.Variable)
      self.assertIs(wrapped_stage._a, a_var)
      self.assertIsInstance(wrapped_stage._b, tf.Variable)
      self.assertIs(wrapped_stage._b, b_var)
  
      # Test the functionality remain unchanged.
      self.assertEqual(stage.name, wrapped_stage.name)
      self.assertEqual(
          stage.compressible_tensors_keys,
          wrapped_stage.compressible_tensors_keys,
      )
      self.assertEqual(
          stage.commutes_with_sum, wrapped_stage.commutes_with_sum
      )
      self.assertEqual(
          stage.decode_needs_input_shape,
          wrapped_stage.decode_needs_input_shape,
      )
  
      self.evaluate(tf.compat.v1.global_variables_initializer())
      test_data = test_utils.TestData(
          *self.evaluate([x, encoded_x, decoded_x])
      )
      self.assertEqual(2.0, test_data.x)
      self.assertEqual(
          7.0,
          test_data.encoded_x[
              test_utils.SimpleLinearEncodingStage.ENCODED_VALUES_KEY
          ],
      )
      self.assertEqual(2.0, test_data.decoded_x)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import mock
  import numpy
  import tensorflow
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.core import encoding_stage
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.testing import test_utils
label_desc: Use image node_id 1 for calling the NoneStateAdaptiveEncodingStageTest obj's underlying member method code with example usage: obj.test_as_adaptive_encoding_stage() without return types