import tensorflow as tf

          else:
            bottom = out # l (not l + 1) because from previous layer
            W = weight_variable([1, FLAGS.conv_kernel, FLAGS.conv_kernel, FLAGS.feats_per_layer, FLAGS.feats_per_layer])

        b = bias_variable([FLAGS.feats_per_layer])
        Wx_b = tf.nn.conv3d(bottom, W, strides=[1,1,1,1,1], padding='VALID') + b
        out = tf.nn.relu(Wx_b)
        shape = out.get_shape()
        print('conv{}'.format(l+1))
        print('\t{} --> {}'.format(bottom.name, out.name))
        print('\t{} --> {}'.format(bottom.get_shape(), out.get_shape()))
      with tf.variable_scope('pool'):
        bottom = out
        if l == num_layers - 1 and FLAGS.total_pool:
          kernel_size = bottom.get_shape()[2]
          out = tf.nn.max_pool3d(bottom, ksize=[1,1, kernel_size, kernel_size,1], strides=[1,1,1,1,1], padding='VALID')
        else:
          out = tf.nn.max_pool3d(bottom, ksize=[1,1, FLAGS.pool_kernel, FLAGS.pool_kernel,1], strides=[1,1,FLAGS.pool_stride,FLAGS.pool_stride,1], padding='VALID')
        shape = out.get_shape()
        print('pool{}'.format(l + 1))
        print('\t{} --> {}'.format(bottom.name, out.name))
        print('\t{} --> {}'.format(bottom.get_shape(), out.get_shape()))
      with tf.variable_scope('scale'):
        bottom = out
        if FLAGS.pm[l + 1]  == FLAGS.pm[l]:
          kernel_size = 1 # useless 1x1 pooling
        elif int(FLAGS.pm[l + 1]) < int(FLAGS.pm[l]):
          num_scales_prev = int(FLAGS.pm[l])
          num_scales_current = int(FLAGS.pm[l + 1])
          kernel_size = (num_scales_prev - num_scales_current) + 1
