class_docstr: This wrapper reparameterizes a layer by decoupling the weight's
  magnitude and direction. This speeds up convergence by improving the
  conditioning of the optimization problem.
  
  Weight Normalization: A Simple Reparameterization to Accelerate
  Training of Deep Neural Networks: https://arxiv.org/abs/1602.07868
  Tim Salimans, Diederik P. Kingma (2016)
  
  WeightNorm wrapper works for keras and tf layers.
  
  ```python
    net = WeightNorm(tf.keras.layers.Conv2D(2, 2, activation='relu'),
           input_shape=(32, 32, 3), data_init=True)(x)
    net = WeightNorm(tf.keras.layers.Conv2D(16, 5, activation='relu'),
                     data_init=True)
    net = WeightNorm(tf.keras.layers.Dense(120, activation='relu'),
                     data_init=True)(net)
    net = WeightNorm(tf.keras.layers.Dense(n_classes),
                     data_init=True)(net)
  ```
  
  Arguments:
    layer: a layer instance.
    data_init: If `True` use data dependent variable initialization
  
  Raises:
    ValueError: If not initialized with a `Layer` instance.
    ValueError: If `Layer` does not contain a `kernel` of weights
    NotImplementedError: If `data_init` is True and running graph execution
docstr: Build `Layer`
docstr_tok: ["Build","`","Layer","`"]
code: def build(self, input_shape):
      """Build `Layer`"""
      input_shape = tensor_shape.TensorShape(input_shape).as_list()
      self.input_spec = 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=initializers.get("ones"),
              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.layer.built = True
  
      super(WeightNorm, self).build()
      self.built = True
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.keras.layers import Wrapper
  from tensorflow.python.layers.convolutional import Conv1D
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.keras.engine.base_layer import Layer
  from tensorflow.python.eager import context
  from tensorflow.python.ops import nn_impl
  from tensorflow.python.keras import initializers
  from tensorflow.python.keras.engine.base_layer import InputSpec
  from tensorflow.python.ops import array_ops
  from tensorflow.python.framework import ops
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