code: def testAppliesQuantizationPreActivation(self):
      layer = self.TestLayer()
      layer.activation = QuantizeAwareActivation(
          activations.get("softmax"), self.quantizer, 0, layer
      )
  
      model = keras.Sequential([layer])
  
      x = np.array([[1.0, 2.0]])
      # expected_activation is determined using the float buckets when [-6, 6] is
      # quantized. Derived using `tf.fake_quant_with_min_max_vars`. For sigmoid,
      # quantization is applied twice.
      #
      # FakeQuant([1.0, 2.0]) = [0.9882355, 1.9764705]
      # Softmax([0.9882355, 1.9764705]) = [0.27126083, 0.72873914]
      expected_activation = np.array([[0.27126083, 0.72873914]])
  
      for weight in layer.weights:
          self.assertIn("pre_activation", weight.name)
      self.assertAllClose(expected_activation, model.predict(x))
  
file_path: model-optimization/tensorflow_model_optimization/python/core/quantization/keras/quantize_aware_activation_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_model_optimization.python.core.quantization.keras import quantize_aware_activation
  from tensorflow_model_optimization.python.core.quantization.keras import quantizers
  from tensorflow_model_optimization.python.core.quantization.keras import utils
label_desc: Use image node_id 5 for calling the QuantizeAwareQuantizationTest obj's underlying member method code with example usage: obj.testAppliesQuantizationPreActivation() without return types