'Residual unit with 2 sub layers, using Plan A for shortcut connection.'

def _residual_v1(self, x, kernel_size, in_filter, out_filter, stride, activate_before_residual=False):

    del activate_before_residual
    with tf.name_scope('residual_v1') as name_scope:
        orig_x = x
        x = self._conv(x, kernel_size, out_filter, stride)
        x = self._batch_norm(x)
        x = self._relu(x)
        x = self._conv(x, kernel_size, out_filter, 1)
        x = self._batch_norm(x)
        if (in_filter != out_filter):
            orig_x = self._avg_pool(orig_x, stride, stride)
            pad = ((out_filter - in_filter) // 2)
            if (self._data_format == 'channels_first'):
                orig_x = tf.pad(orig_x, [[0, 0], [pad, pad], [0, 0], [0, 0]])
            else:
                orig_x = tf.pad(orig_x, [[0, 0], [0, 0], [0, 0], [pad, pad]])
        x = self._relu(tf.add(x, orig_x))
        tf.logging.info('image    after    unit    %s:    %s', name_scope, x.get_shape())
        return x
