docstr: Build `Layer`.
  
  Parameters
  ----------
  input_shape
      The shape of the input to `self.layer`.
  
  Raises
  ------
  ValueError
      If `Layer` does not contain a `kernel` of weights.
code: def build(self, input_shape=None):
      """Build `Layer`.
  
      Parameters
      ----------
      input_shape
          The shape of the input to `self.layer`.
  
      Raises
      ------
      ValueError
          If `Layer` does not contain a `kernel` of weights.
      """
      input_shape = tf.TensorShape(input_shape).as_list()
      input_shape[0] = None
      self.input_spec = tf.keras.layers.InputSpec(shape=input_shape)
  
      if not self.layer.built:
          self.layer.build(input_shape)
  
          if not hasattr(self.layer, "kernel"):
              raise ValueError(
                  "`WeightNorm` must wrap a layer that contains a `kernel` for weights"
              )
  
          self.kernel_norm_axes = list(
              range(self.layer.kernel.shape.ndims)
          )
          self.kernel_norm_axes.pop(self.filter_axis)
  
          self.v = self.layer.kernel
  
          # to avoid a duplicate `kernel` variable after `build` is called
          self.layer.kernel = None
          self.g = self.add_weight(
              name="g",
              shape=(int(self.v.shape[self.filter_axis]),),
              initializer="ones",
              dtype=self.v.dtype,
              trainable=True,
          )
          self.initialized = self.add_weight(
              name="initialized", dtype=tf.bool, trainable=False
          )
          self.initialized.assign(False)
  
      super(WeightNorm, self).build()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import numpy
  import warnings
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import logistic
  from tensorflow_probability.python.distributions import mixture_same_family
  from tensorflow_probability.python.distributions import quantized_distribution
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 5 for calling the WeightNorm obj's underlying member method code with example usage: obj.build(input_shape) without return types