class_docstr: Quantizes the weights and activations of the keras layer it wraps.
class_docstr_tok: ["Quantizes","the","weights","and","activations","of","the","keras","layer","it","wraps","."]
code: def build(self, input_shape):
      super(QuantizeWrapper, self).build(input_shape)
  
      self.optimizer_step = self.add_weight(
          "optimizer_step",
          initializer=tf.keras.initializers.Constant(-1),
          dtype=tf.dtypes.int32,
          trainable=False,
      )
  
      self._weight_vars = []
      for (
          weight,
          quantizer,
      ) in self.quantize_config.get_weights_and_quantizers(self.layer):
          quantizer_vars = quantizer.build(
              weight.shape, self._weight_name(weight.name), self
          )
  
          self._weight_vars.append((weight, quantizer, quantizer_vars))
          # Needed to ensure unquantized weights get trained as part of the wrapper.
          self._trainable_weights.append(weight)
  
      self._quantize_activations = []
      for (
          activation,
          quantizer,
      ) in self.quantize_config.get_activations_and_quantizers(
          self.layer
      ):
          quantize_activation = (
              quantize_aware_activation.QuantizeAwareActivation(
                  activation, quantizer, self.optimizer_step, self
              )
          )
  
          self._quantize_activations.append(quantize_activation)
  
      self._output_quantizers = (
          self.quantize_config.get_output_quantizers(self.layer)
      )
      if self._output_quantizers:
          self._output_quantizer_vars = self._output_quantizers[
              0
          ].build(
              self.layer.compute_output_shape(input_shape),
              "output",
              self,
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from tensorflow.python.util import tf_inspect
  from tensorflow_model_optimization.python.core.keras import metrics
  from tensorflow_model_optimization.python.core.keras import utils
  from tensorflow_model_optimization.python.core.quantization.keras import quantize_aware_activation
  from tensorflow_model_optimization.python.core.quantization.keras import utils
label_desc: Use image node_id 4 for calling the QuantizeWrapper obj's underlying member method code with example usage: obj.build(input_shape) without return types