import tensorflow as tf

            return tf.nn.batch_normalization(inp, moving_mean, moving_variance, offset, scale, 0.01, name='norm')


def pool(inp, name, kind, size, stride, padding='SAME'):
    
    assert kind in ['max', 'avg']
    
    strides = [1, stride, stride, 1]
    sizes = [1, size, size, 1]
    
    with tf.variable_scope(name):
        if kind == 'max':
            out = tf.nn.max_pool(inp, sizes, strides=strides, padding=padding, name=kind)
        else:
            out = tf.nn.avg_pool(inp, sizes, strides=strides, padding=padding, name=kind)
    
    return out


def ResNet18(inp, phase, num_outputs=1000, alpha=0.0):
    def residual_block(inp, phase, alpha=0.0,nom='a',increase_dim=False,last=False):
        input_num_filters = inp.get_shape().as_list()[3]
        if increase_dim:
            first_stride = [1, 2, 2, 1]
