class_docstr: Defines how to apply a faster version of the EPR algorithm.
class_docstr_tok: ["Defines","how","to","apply","a","faster","version","of","the","EPR","algorithm","."]
code: def regularization_loss(
      self, *training_weights: tf.Tensor
  ) -> tf.Tensor:
      if len(training_weights) == 2:
          # Bias or dense kernel.
          weight, log_step = training_weights
      else:
          # Convolution kernel.
          weight, _, log_step = training_weights
      em = tfc.PowerLawEntropyModel(
          coding_rank=weight.shape.rank, alpha=self.alpha
      )
      return em.penalty(weight / tf.exp(log_step))
  
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 6 for calling the FastEPR obj's underlying member method code with example usage: obj.regularization_loss() and returns: em