'Verify the values of dense feature extraction by atrous convolution.
Make sure that dense feature extraction by stack_blocks_dense() followed by
subsampling gives identical results to feature extraction at the nominal
network output stride using the simple self._stack_blocks_nondense() above.'

def testAtrousValuesBottleneck(self):

    block = resnet_v2.resnet_v2_block
    blocks = [block('block1', base_depth=1, num_units=2, stride=2), block('block2', base_depth=2, num_units=2, stride=2), block('block3', base_depth=4, num_units=2, stride=2), block('block4', base_depth=8, num_units=2, stride=1)]
    nominal_stride = 8
    height = 30
    width = 31
    with slim.arg_scope(resnet_utils.resnet_arg_scope()):
        with slim.arg_scope([slim.batch_norm], is_training=False):
            for output_stride in [1, 2, 4, 8, None]:
                with tf.Graph().as_default():
                    with self.test_session() as sess:
                        tf.set_random_seed(0)
                        inputs = create_test_input(1, height, width, 3)
                        output = resnet_utils.stack_blocks_dense(inputs, blocks, output_stride)
                        if (output_stride is None):
                            factor = 1
                        else:
                            factor = (nominal_stride // output_stride)
                        output = resnet_utils.subsample(output, factor)
                        tf.get_variable_scope().reuse_variables()
                        expected = self._stack_blocks_nondense(inputs, blocks)
                        sess.run(tf.global_variables_initializer())
                        (output, expected) = sess.run([output, expected])
                        self.assertAllClose(output, expected, atol=0.0001, rtol=0.0001)
