class_docstr: Define how to apply SVD algorithm.
  
  This periodic update and scheduling base SVD algorithm update the original
  weights to make lower rank by SVD for each update_freq steps. During the
  warmup steps, It adjust the rank from the original to target rank gradually.
class_docstr_tok: ["Define","how","to","apply","SVD","algorithm",".","This","periodic","update","and","scheduling","base","SVD","algorithm","update","the","original","weights","to","make","lower","rank","by","SVD","for","each","update_freq","steps",".","During","the","warmup","steps",",","It","adjust","the","rank","from","the","original","to","target","rank","gradually","."]
docstr: Model developer API for optimizing a model for inference.
  
  Args:
    to_compress: The model that trained for compression. This model should
      generated from the `optimize_model` method.
  Returns:
    A compressed model for the inference.
docstr_tok: ["Model","developer","API","for","optimizing","a","model","for","inference",".","Args",":","to_compress",":","The","model","that","trained","for","compression",".","This","model","should","generated","from","the","`","optimize_model","`","method",".","Returns",":","A","compressed","model","for","the","inference","."]
code: def compress_model(
      self, to_compress: tf.keras.Model
  ) -> tf.keras.Model:
      """Model developer API for optimizing a model for inference.
  
      Args:
        to_compress: The model that trained for compression. This model should
          generated from the `optimize_model` method.
      Returns:
        A compressed model for the inference.
      """
  
      def _optimize_layer(layer):
          # Require layer to be built so that the SVD-factorized weights
          # can be initialized from the weights.
          if not layer.built:
              raise ValueError(
                  "Applying SVD currently requires passing in a built model"
              )
  
          return algorithm.create_layer_for_inference(
              layer, algorithm=self
          )
  
      return tf.keras.models.clone_model(
          to_compress, clone_function=_optimize_layer
      )
  
file_path: model-optimization/tensorflow_model_optimization/python/core/common/keras/compression/algorithms/periodical_update_and_scheduling.py
imports: from typing import List
  import tensorflow
  from tensorflow_model_optimization.python.core.common.keras.compression import algorithm
label_desc: Use image node_id 8 for calling the SVD obj's underlying member method code with example usage: obj.compress_model(to_compress) and returns: tf, algorithm