class_docstr: Defines how to apply the EPR algorithm.
class_docstr_tok: ["Defines","how","to","apply","the","EPR","algorithm","."]
code: def regularization_loss(
      self, *training_weights: tf.Tensor
  ) -> tf.Tensor:
      if len(training_weights) == 3:
          # Bias or dense kernel.
          weight, log_step, log_scale = training_weights
      else:
          # Convolution kernel.
          weight, _, log_step, log_scale = training_weights
      prior = tfc.NoisyLogistic(loc=0.0, scale=tf.exp(log_scale))
      em = tfc.ContinuousBatchedEntropyModel(
          prior,
          coding_rank=weight.shape.rank,
          compression=False,
          offset_heuristic=False,
      )
      _, bits = em(weight / tf.exp(log_step), training=True)
      return bits
  
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 EPR obj's underlying member method code with example usage: obj.regularization_loss() and returns: bits