class_docstr: Define how to apply BiasOnly algorithm.
code: def init_training_weights(self, pretrained_weight: tf.Tensor):
      bias_mean = tf.reduce_mean(pretrained_weight)
      bias_shape = tf.shape(pretrained_weight)
  
      # TODO(tfmot): note that it does not suffice to just have the initializer
      # to derive the shape from, in the case of a constant initializer.
      # The unit test fail without providing the shape.
      self.add_training_weight(
          name="bias_mean",
          shape=bias_mean.shape,
          dtype=bias_mean.dtype,
          initializer=tf.keras.initializers.Constant(bias_mean),
      )
      self.add_training_weight(
          name="bias_shape",
          shape=bias_shape.shape,
          dtype=bias_shape.dtype,
          initializer=tf.keras.initializers.Constant(bias_shape),
      )
  
file_path: model-optimization/tensorflow_model_optimization/python/core/common/keras/compression/algorithms/bias_only.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 1 for calling the BiasOnly obj's underlying member method code with example usage: obj.init_training_weights(pretrained_weight) without return types