code: def custom_dense(
      x,
      units,
      activation=None,
      he_initializer_slope=1.0,
      use_weight_scaling=True,
      scope="custom_dense",
      reuse=None,
  ):
      """Custom dense layer.
  
      In comparison with tf.layers.dense This implementation use the He
      initializer to initialize weights and the weight scaling trick
      (if `use_weight_scaling` is True) to equalize learning rates. See
      https://arxiv.org/abs/1710.10196 for more details.
  
      Args:
        x: A `Tensor`.
        units: An int of the last dimension size of output.
        activation: An activation function to be applied. None means no
            activation. Defaults to None.
        he_initializer_slope: A float slope for the He initializer. Defaults to 1.0.
        use_weight_scaling: Whether to apply weight scaling. Defaults to True.
        scope: A string or variable scope.
        reuse: Whether to reuse the weights. Defaults to None.
  
      Returns:
        A `Tensor` where the last dimension has size `units`.
      """
      x = tf.layers.flatten(x)
  
      def _apply_kernel(kernel_shape, kernel_initializer):
          return tf.layers.dense(
              x,
              kernel_shape[1],
              use_bias=False,
              kernel_initializer=kernel_initializer,
          )
  
      with tf.variable_scope(scope, reuse=reuse):
          return _custom_layer_impl(
              _apply_kernel,
              kernel_shape=(x.shape.as_list()[-1], units),
              bias_shape=(units,),
              activation=activation,
              he_initializer_slope=he_initializer_slope,
              use_weight_scaling=use_weight_scaling,
          )
  
file_path: magenta/magenta/models/gansynth/lib/layers.py
imports: import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 13 for calling a global function with example usage: custom_dense(x, units, activation, he_initializer_slope, use_weight_scaling, scope, reuse) and returns: tf, _custom_layer_impl