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 call(self, inputs, training=None, **kwargs):
      if training is None:
          training = tf.keras.backend.learning_phase()
  
      # Quantize all weights, and replace them in the underlying layer.
  
      quantized_weights = []
      for (
          unquantized_weight,
          quantizer,
          quantizer_vars,
      ) in self._weight_vars:
          quantized_weight = utils.smart_cond(
              training,
              self._make_quantizer_fn(
                  quantizer, unquantized_weight, True, quantizer_vars
              ),
              self._make_quantizer_fn(
                  quantizer, unquantized_weight, False, quantizer_vars
              ),
          )
          quantized_weights.append(quantized_weight)
  
      self.quantize_config.set_quantize_weights(
          self.layer, quantized_weights
      )
  
      # Replace all activations with `QuantizeAwareActivation`s which can
      # quantize activation tensors during graph construction.
  
      for quantize_activation in self._quantize_activations:
          quantize_activation.training = training
  
      self.quantize_config.set_quantize_activations(
          self.layer, self._quantize_activations
      )
  
      args = tf_inspect.getfullargspec(self.layer.call).args
      if "training" in args:
          outputs = self.layer.call(inputs, training=training, **kwargs)
      else:
          outputs = self.layer.call(inputs, **kwargs)
  
      if not self._output_quantizers:
          return outputs
  
      # Assuming outputs is a single tensor. There might be some rare layers
      # where this is not true. Handle them when enabling such a layer.
      if isinstance(outputs, list) or isinstance(outputs, tuple):
          raise RuntimeError(
              "Multiple output tensors not handled currently."
          )
  
      output_quantizer = self._output_quantizers[0]
      return utils.smart_cond(
          training,
          self._make_quantizer_fn(
              output_quantizer,
              outputs,
              True,
              self._output_quantizer_vars,
          ),
          self._make_quantizer_fn(
              output_quantizer,
              outputs,
              False,
              self._output_quantizer_vars,
          ),
      )
  
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 7 for calling the QuantizeWrapper obj's underlying member method code with example usage: obj.call(inputs, training) and returns: utils, outputs