code: def _custom_layer_impl(
      apply_kernel,
      kernel_shape,
      bias_shape,
      activation,
      he_initializer_slope,
      use_weight_scaling,
  ):
      """Helper function to implement custom_xxx layer.
  
      Args:
        apply_kernel: A function that transforms kernel to output.
        kernel_shape: An integer tuple or list of the kernel shape.
        bias_shape: An integer tuple or list of the bias shape.
        activation: An activation function to be applied. None means no
            activation.
        he_initializer_slope: A float slope for the He initializer.
        use_weight_scaling: Whether to apply weight scaling.
  
      Returns:
        A `Tensor` computed as apply_kernel(kernel) + bias where kernel is a
        `Tensor` variable with shape `kernel_shape`, bias is a `Tensor` variable
        with shape `bias_shape`.
      """
      kernel_scale = he_initializer_scale(
          kernel_shape, he_initializer_slope
      )
      init_scale, post_scale = kernel_scale, 1.0
      if use_weight_scaling:
          init_scale, post_scale = post_scale, init_scale
  
      kernel_initializer = tf.random_normal_initializer(
          stddev=init_scale
      )
  
      bias = tf.get_variable(
          "bias", shape=bias_shape, initializer=tf.zeros_initializer()
      )
  
      output = (
          post_scale * apply_kernel(kernel_shape, kernel_initializer)
          + bias
      )
  
      if activation is not None:
          output = activation(output)
      return output
  
file_path: magenta/magenta/models/gansynth/lib/layers.py
imports: import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 11 for calling a global function with example usage: _custom_layer_impl(apply_kernel, kernel_shape, bias_shape, activation, he_initializer_slope, use_weight_scaling) and returns: output