class_docstr: Quantize weights while preserve sparsity.
class_docstr_tok: ["Quantize","weights","while","preserve","sparsity","."]
docstr: Applies sparsity preserved quantization to the input tensor.
  
  Args:
    inputs: Input tensor (layer's weights) to be quantized.
    training: Whether the graph is currently training.
    weights: Dictionary of weights (params) the quantizer can use to
      quantize the tensor (layer's weights). This contains the weights
      created in the `build` function.
    **kwargs: Additional variables which may be passed to the quantizer.
  
  Returns:
    quantized tensor.
docstr_tok: ["Applies","sparsity","preserved","quantization","to","the","input","tensor",".","Args",":","inputs",":","Input","tensor","(","layer","'s","weights",")","to","be","quantized",".","training",":","Whether","the","graph","is","currently","training",".","weights",":","Dictionary","of","weights","(","params",")","the","quantizer","can","use","to","quantize","the","tensor","(","layer","'s","weights",")",".","This","contains","the","weights","created","in","the","`","build","`","function",".","*","*","kwargs",":","Additional","variables","which","may","be","passed","to","the","quantizer",".","Returns",":","quantized","tensor","."]
code: def __call__(self, inputs, training, weights, **kwargs):
      """Applies sparsity preserved quantization to the input tensor.
  
      Args:
        inputs: Input tensor (layer's weights) to be quantized.
        training: Whether the graph is currently training.
        weights: Dictionary of weights (params) the quantizer can use to
          quantize the tensor (layer's weights). This contains the weights
          created in the `build` function.
        **kwargs: Additional variables which may be passed to the quantizer.
  
      Returns:
        quantized tensor.
      """
  
      prune_preserve_inputs = tf.multiply(
          inputs, weights["sparsity_mask"]
      )
  
      return quant_ops.LastValueQuantize(
          prune_preserve_inputs,
          weights["min_var"],
          weights["max_var"],
          is_training=training,
          num_bits=self.num_bits,
          per_channel=self.per_axis,
          symmetric=self.symmetric,
          narrow_range=self.narrow_range,
      )
  
imports: import tensorflow
  from tensorflow_model_optimization.python.core.quantization.keras import quant_ops
  from tensorflow_model_optimization.python.core.quantization.keras import quantizers
  from tensorflow_model_optimization.python.core.quantization.keras.default_8bit import default_8bit_quantize_registry
  from tensorflow_model_optimization.python.core.quantization.keras.default_8bit import default_8bit_quantizers
label_desc: Use image node_id 4 for calling the PrunePreserveDefaultWeightsQuantizer obj's underlying member method code with example usage: obj.__call__(inputs, training, weights) and returns: quant_ops