modify tf open source to finish ablation experiment

step1:

import tensorflow as tf
tf.__path__

tf.__path__+ tensorflow/conrib /slim/python/slim/nets/resnet_v1.py

step2: modify function as follow

1. add
import tensorflow as tf

2. replace funtion
@add_arg_scope
def bottleneck(inputs,
               depth,
               depth_bottleneck,
               stride,
               rate=1,
               outputs_collections=None,
               scope=None):
    """Bottleneck residual unit variant with BN after convolutions.

    This is the original residual unit proposed in [1]. See Fig. 1(a) of [2] for
    its definition. Note that we use here the bottleneck variant which has an
    extra bottleneck layer.

    When putting together two consecutive ResNet blocks that use this unit, one
    should use stride = 2 in the last unit of the first block.

    Args:
      inputs: A tensor of size [batch, height, width, channels].
      depth: The depth of the ResNet unit output.
      depth_bottleneck: The depth of the bottleneck layers.
      stride: The ResNet unit's stride. Determines the amount of downsampling of
        the units output compared to its input.
      rate: An integer, rate for atrous convolution.
      outputs_collections: Collection to add the ResNet unit output.
      scope: Optional variable_scope.

    Returns:
      The ResNet unit's output.
    """
    with variable_scope.variable_scope(scope, 'bottleneck_v1', [inputs]) as sc:
        depth_in = utils.last_dimension(inputs.get_shape(), min_rank=4)
        if depth == depth_in:
            shortcut = resnet_utils.subsample(inputs, stride, 'shortcut')
        else:
            shortcut = layers.conv2d(
                inputs,
                depth, [1, 1],
                stride=stride,
                activation_fn=None,
                scope='shortcut')

        residual = layers.conv2d(
            inputs, depth_bottleneck, [1, 1], stride=1, scope='conv1')

        # --my own code---
        residual = tf.placeholder_with_default(residual, (residual.shape),
                                               name='conv1/placeholder_with_default')
        print(residual)
        # ----------------

        residual = resnet_utils.conv2d_same(
            residual, depth_bottleneck, 3, stride, rate=rate, scope='conv2')

        # --my own code---
        residual = tf.placeholder_with_default(residual, (residual.shape),
                                               name='conv2/placeholder_with_default')
        print(residual)
        # ----------------

        residual = layers.conv2d(
            residual, depth, [1, 1], stride=1, activation_fn=None, scope='conv3')

        # --my own code---
        output = tf.placeholder_with_default(output, (output.shape),
                                             name='conv3/placeholder_with_default')
        print(output)
        # ----------------

        output = nn_ops.relu(shortcut + residual)

        return utils.collect_named_outputs(outputs_collections, sc.name, output)