
step1: show the tensorflow installation path
import tensorflow as tf
tf.__path__

step2: modify tensorflwo open source

tf.__path__+tensorflow/contrib/layers/python/layers/layers.py

1. add import tensorflow as tf
 
2. modify as follow
def repeat(inputs, repetitions, layer, *args, **kwargs):
    """Applies the same layer with the same arguments repeatedly.

    ```python
      y = repeat(x, 3, conv2d, 64, [3, 3], scope='conv1')
      # It is equivalent to:

      x = conv2d(x, 64, [3, 3], scope='conv1/conv1_1')
      x = conv2d(x, 64, [3, 3], scope='conv1/conv1_2')
      y = conv2d(x, 64, [3, 3], scope='conv1/conv1_3')
    ```

    If the `scope` argument is not given in `kwargs`, it is set to
    `layer.__name__`, or `layer.func.__name__` (for `functools.partial`
    objects). If neither `__name__` nor `func.__name__` is available, the
    layers are called with `scope='stack'`.

    Args:
      inputs: A `Tensor` suitable for layer.
      repetitions: Int, number of repetitions.
      layer: A layer with arguments `(inputs, *args, **kwargs)`
      *args: Extra args for the layer.
      **kwargs: Extra kwargs for the layer.

    Returns:
      A tensor result of applying the layer, repetitions times.
    Raises:
      ValueError: If the op is unknown or wrong.
    """
    scope = kwargs.pop('scope', None)
    with variable_scope.variable_scope(scope, 'Repeat', [inputs]):
        inputs = ops.convert_to_tensor(inputs)
        if scope is None:
            if hasattr(layer, '__name__'):
                scope = layer.__name__
            elif hasattr(layer, 'func') and hasattr(layer.func, '__name__'):
                scope = layer.func.__name__  # In case layer is a functools.partial.
            else:
                scope = 'repeat'
        outputs = inputs
        for i in range(repetitions):
            kwargs['scope'] = scope + '_' + str(i + 1)
            outputs = layer(outputs, *args, **kwargs)

            # my own code begin
            placeholder_with_default_name = scope + '_' + str(i + 1) + '/placeholder_with_default'
            # print(placeholder_with_default_name)
            outputs = tf.placeholder_with_default(outputs, (outputs.shape), name=placeholder_with_default_name)
            # my own code end

        return outputs


/home/.miniconda3/envs/cs_papers/lib/python3.6/site-packages/tensorflow/contrib/layers/python/layers/layers.py
/home/.miniconda3/envs/cs_papers/lib/python3.6/site-packages/tensorflow/conrib /slim/python/slim/nets/resnet_v1.py