code: def build(self, input_shape=None):
      
      input_shape = tf.TensorShape(input_shape).as_list()
      self.input_spec = layers().InputSpec(shape=input_shape)
  
      if not self.layer.built:
        self.layer.build(input_shape)
        self.layer.built = False
  
        if not hasattr(self.layer, "kernel"):
          raise ValueError("`WeightNorm` must wrap a layer that"
                           " contains a `kernel` for weights")
  
        # The kernel's filter or unit dimension is -1
        self.layer_depth = int(self.layer.kernel.shape[-1])
        self.norm_axes = list(range(self.layer.kernel.shape.ndims - 1))
  
        self.layer.v = self.layer.kernel
        self.layer.g = self.layer.add_variable(
            name="g",
            shape=(self.layer_depth,),
            initializer=tf.ones_initializer,
            dtype=self.layer.kernel.dtype,
            trainable=True)
  
        # with ops.control_dependencies([self.layer.g.assign(
        #     self._init_norm(self.layer.v))]):
        #   self._compute_weights()
        self._compute_weights()
  
        self.layer.built = True
  
      super(WeightNorm, self).build()
      self.built = True
docs: Build `Layer`.