def layer(l, layername, features, count, stride, first=False):
    with tf.variable_scope(layername):
        with tf.variable_scope('block0'):
            l = bottleneck(l, features, stride, ('no_preact' if first else 'both_preact'))
        for i in range(1, count):
            with tf.variable_scope('block{}'.format(i)):
                l = bottleneck(l, features, 1, 'both_preact')
        return l
def layer(l, layername, features, count, stride, first=False):
    with tf.variable_scope(layername):
        with tf.variable_scope('block0'):
            l = bottleneck(l, features, stride, ('no_preact' if first else 'both_preact'))
        for i in range(1, count):
            with tf.variable_scope('block{}'.format(i)):
                l = bottleneck(l, features, 1, 'both_preact')
        return l