(apply_kernel, kernel_shape, bias_shape, activation,
                       he_initializer_slope, use_weight_scaling)
return output
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`.
Helper function to implement custom_xxx layer.
Helper function to implement custom_xxx layer .
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
def _custom_layer_impl ( apply_kernel , kernel_shape , bias_shape , activation , he_initializer_slope , use_weight_scaling ) : 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