code: def test_encoding_randomized(self):
      # The encoding stage declares a source of randomness (a random seed) in the
      # get_params method, and different encoding should be produced for each
      # random seed. This tests that this is the case, and that the encoding is
      # still lossless.
      stage = self.default_encoding_stage()
      x = np.random.randn(20).astype(np.float32)
      test_data_1 = self.run_one_to_many_encode_decode(stage, lambda: x)
      test_data_2 = self.run_one_to_many_encode_decode(stage, lambda: x)
      # Make sure we encode the same object.
      self.assertAllClose(test_data_1.x, test_data_2.x)
      self.assertAllClose(test_data_1.x, test_data_1.decoded_x)
      self.assertAllClose(test_data_2.x, test_data_2.decoded_x)
      encoded_x_1 = test_data_1.encoded_x[
          stages_impl.HadamardEncodingStage.ENCODED_VALUES_KEY
      ]
      encoded_x_2 = test_data_2.encoded_x[
          stages_impl.HadamardEncodingStage.ENCODED_VALUES_KEY
      ]
      self.assertGreater(np.linalg.norm(encoded_x_1 - encoded_x_2), 0.1)
  
imports: import itertools
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.stages import stages_impl
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.testing import test_utils
label_desc: Use image node_id 5 for calling the HadamardEncodingStageTest obj's underlying member method code with example usage: obj.test_encoding_randomized() without return types