class_docstr: Represent modifications to training graph for weight compression.
class_docstr_tok: ["Represent","modifications","to","training","graph","for","weight","compression","."]
code: def build(
      self, input_shape
  ):  # pytype: disable=signature-mismatch  # overriding-parameter-count-checks
      # Building nested layer via `super` must happen first
      # so that the nested layer's variables
      # are available to `init_training_weights`.
      super(_TrainingWrapper, self).build(input_shape)
  
      # Add weights needed by algorithm during training.
      self.training_weights = {}
      for name in self.compressible_weights:
          compressible_weight = self.dummy_name_to_tensor[name]
  
          # Note that as standard in `build` methods, the handling of pretrained
          # weights actually occurs outside the wrapper. This only initializes
          # weights with dummy values. Additionally, we don't have access to the
          # actual values of the nested layer's weights since they are no longer
          # variables, due to `_skip_compressible_weights` from `__init__`.
          assert isinstance(compressible_weight, tf.Tensor)
          self.algorithm.weight_reprs = []
          self.algorithm.init_training_weights(compressible_weight)
  
          weights = []
          for weight_repr in self.algorithm.weight_reprs:
              weight = self.add_weight(
                  *weight_repr.args, **weight_repr.kwargs
              )
              weights.append(weight)
  
          self.training_weights[name] = weights
  
      self.attr_name_map = {}
      for attr_name in dir(self.layer):
          try:
              value = getattr(self.layer, attr_name)
              name = self._get_name_by_tensor(value)
          except AttributeError:
              # TODO(tfmot): Some attributes are not accessible like
              # 'input', 'input_mask', 'input_shape',
              # 'output', 'output_mask', 'output_shape'
              pass
          if name:
              self.attr_name_map[attr_name] = name
  
imports: from typing import List, Mapping
  import tensorflow
label_desc: Use image node_id 4 for calling the _TrainingWrapper obj's underlying member method code with example usage: obj.build(input_shape) without return types