# Path: nets/resnet_utils.py
# class Block(collections.namedtuple('Block', ['scope', 'unit_fn', 'args'])):
# def subsample(inputs, factor, scope=None):
# def conv2d_same(inputs, num_outputs, kernel_size, stride, rate=1, scope=None):
# def stack_blocks_dense(net, blocks, output_stride=None,
#                        outputs_collections=None):
# def resnet_arg_scope(weight_decay=0.0001,
#                      batch_norm_decay=0.997,
#                      batch_norm_epsilon=1e-5,
#                      batch_norm_scale=True,
#                      activation_fn=tf.nn.relu,
#                      use_batch_norm=True):


import tensorflow as tf
from nets import resnet_utils
      reuse: whether or not the network and its variables should be reused. To be
        able to reuse 'scope' must be given.
      scope: Optional variable_scope.

    Returns:
      net: A rank-4 tensor of size [batch, height_out, width_out, channels_out].
        If global_pool is False, then height_out and width_out are reduced by a
        factor of output_stride compared to the respective height_in and width_in,
        else both height_out and width_out equal one. If num_classes is None, then
        net is the output of the last ResNet block, potentially after global
        average pooling. If num_classes is not None, net contains the pre-softmax
        activations.
      end_points: A dictionary from components of the network to the corresponding
        activation.

    Raises:
      ValueError: If the target output_stride is not valid.
    """
    with tf.variable_scope(scope, 'resnet_v1', [inputs], reuse=reuse) as sc:
        end_points_collection = sc.name + '_end_points'
        with slim.arg_scope([slim.conv2d, bottleneck,
                             resnet_utils.stack_blocks_dense],
                            outputs_collections=end_points_collection):
            with slim.arg_scope([slim.batch_norm], is_training=is_training):
                net = inputs
                if include_root_block:
                    if output_stride is not None:
                        if output_stride % 4 != 0:
                            raise ValueError('The output_stride needs to be a multiple of 4.')
                        output_stride /= 4

# Path: nets/resnet_utils.py
# class Block(collections.namedtuple('Block', ['scope', 'unit_fn', 'args'])):
# def subsample(inputs, factor, scope=None):
# def conv2d_same(inputs, num_outputs, kernel_size, stride, rate=1, scope=None):
# def stack_blocks_dense(net, blocks, output_stride=None,
#                        outputs_collections=None):
# def resnet_arg_scope(weight_decay=0.0001,
#                      batch_norm_decay=0.997,
#                      batch_norm_epsilon=1e-5,
#                      batch_norm_scale=True,
#                      activation_fn=tf.nn.relu,
#                      use_batch_norm=True):


# Path: nets/resnet_v1.py
import tensorflow as tf
from nets import resnet_utils

      reuse: whether or not the network and its variables should be reused. To be
        able to reuse 'scope' must be given.
      scope: Optional variable_scope.

    Returns:
      net: A rank-4 tensor of size [batch, height_out, width_out, channels_out].
        If global_pool is False, then height_out and width_out are reduced by a
        factor of output_stride compared to the respective height_in and width_in,
        else both height_out and width_out equal one. If num_classes is None, then
        net is the output of the last ResNet block, potentially after global
        average pooling. If num_classes is not None, net contains the pre-softmax
        activations.
      end_points: A dictionary from components of the network to the corresponding
        activation.

    Raises:
      ValueError: If the target output_stride is not valid.
    """
    with tf.variable_scope(scope, 'resnet_v1', [inputs], reuse=reuse) as sc:
        end_points_collection = sc.name + '_end_points'
        with slim.arg_scope([slim.conv2d, bottleneck,
                             resnet_utils.stack_blocks_dense],
                            outputs_collections=end_points_collection):
            with slim.arg_scope([slim.batch_norm], is_training=is_training):
                net = inputs
                if include_root_block:
                    if output_stride is not None:
                        if output_stride % 4 != 0:
                            raise ValueError('The output_stride needs to be a multiple of 4.')
                        output_stride /= 4

                    net = resnet_utils.conv2d_same(net, 64, 7, stride=2, scope='conv1')