(input_, kernel_size, scope, activation_fn=tf.nn.relu)
A residual block made of two mirror-padded, same-padded convolutions.

  This function expects `kernel_size` to be odd.

  Args:
    input_: 4-D Tensor, the input.
    kernel_size: int (odd-valued) representing the kernel size.
    scope: str, scope under which to operate.
    activation_fn: activation function.

  Returns:
    4-D Tensor, the output.

  Raises:
    ValueError: if `kernel_size` is even.
A residual block made of two mirror-padded, same-padded convolutions.
A residual block made of two mirror - padded same - padded convolutions .
def residual_block(input_, kernel_size, scope, activation_fn=tf.nn.relu):
  """A residual block made of two mirror-padded, same-padded convolutions.

  This function expects `kernel_size` to be odd.

  Args:
    input_: 4-D Tensor, the input.
    kernel_size: int (odd-valued) representing the kernel size.
    scope: str, scope under which to operate.
    activation_fn: activation function.

  Returns:
    4-D Tensor, the output.

  Raises:
    ValueError: if `kernel_size` is even.
  """
  if kernel_size % 2 == 0:
    raise ValueError('kernel_size is expected to be odd.')
  with tf.variable_scope(scope):
    num_outputs = int(input_.get_shape()[-1])
    h_1 = conv2d(input_, kernel_size, 1, num_outputs, 'conv1', activation_fn)
    h_2 = conv2d(h_1, kernel_size, 1, num_outputs, 'conv2', None)
    return input_ + h_2
def residual_block ( input_ , kernel_size , scope , activation_fn = tf . nn . relu ) : if kernel_size % 2 == 0 : raise ValueError ( 'kernel_size is expected to be odd.' ) with tf . variable_scope ( scope ) : num_outputs = int ( input_ . get_shape ( ) [ - 1 ] ) h_1 = conv2d ( input_ , kernel_size , 1 , num_outputs , 'conv1' , activation_fn ) h_2 = conv2d ( h_1 , kernel_size , 1 , num_outputs , 'conv2' , None ) return input_ + h_2