class_docstr: Defines how to apply the EPR algorithm.
class_docstr_tok: ["Defines","how","to","apply","the","EPR","algorithm","."]
docstr: Compresses a model after training with EPR.
docstr_tok: ["Compresses","a","model","after","training","with","EPR","."]
code: def compress_model(self, model: tf.keras.Model) -> tf.keras.Model:
      """Compresses a model after training with EPR."""
      if not (
          isinstance(model, tf.keras.Sequential)
          or model._is_graph_network
      ):  # pylint: disable=protected-access
          raise ValueError(
              "`model` must be either sequential or functional."
          )
      return tf.keras.models.clone_model(
          model,
          clone_function=functools.partial(
              algorithm.create_layer_for_inference, algorithm=self
          ),
      )
  
imports: import functools
  from typing import Callable, List, Tuple
  import tensorflow
  import tensorflow_compression
  from tensorflow_model_optimization.python.core.common.keras.compression import algorithm
label_desc: Use image node_id 5 for calling the EPRBase obj's underlying member method code with example usage: obj.compress_model(model) and returns: tf