import tensorflow as tf

        offset = get_variable("offset", shape=[channels], dtype=tf.float32, initializer=tf.constant_initializer(0.0))
        scale = get_variable("scale", shape=[channels], dtype=tf.float32, initializer=tf.constant_initializer(1.0), regularizer=tf.nn.l2_loss)
        
        mean, variance = tf.nn.moments(inp, axes=[0, 1, 2], shift=moving_mean)
        
        mean_op = moving_mean.assign(decay * moving_mean + (1 - decay) * mean)
        var_op = moving_variance.assign(decay * moving_variance + (1 - decay) * variance)
        
        assert(phase in ['train', 'test'])
        if phase == 'train':
            with tf.control_dependencies([mean_op, var_op]):
                return tf.nn.batch_normalization(inp, mean, variance, offset, scale, 0.01, name='norm')
        else:
            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']
    
