def resnet_v1_generator(self, block_fn, layers):
    'Generator for ResNet v1 models.\n\n    Args:\n      block_fn: `function` for the block to use within the model. Either\n          `residual_block` or `bottleneck_block`.\n      layers: list of 4 `int`s denoting the number of blocks to include in each\n        of the 4 block groups. Each group consists of blocks that take inputs of\n        the same resolution.\n\n    Returns:\n      Model `function` that takes in `inputs` and `is_training` and returns the\n      output `Tensor` of the ResNet model.\n    '

    def model(inputs, is_training=False):
        'Creation of the model graph.'
        inputs = nn_ops.conv2d_fixed_padding(inputs=inputs, filters=64, kernel_size=7, strides=2, data_format=self._data_format)
        inputs = tf.identity(inputs, 'initial_conv')
        inputs = self._batch_norm_relu(inputs, is_training=is_training)
        inputs = tf.layers.max_pooling2d(inputs=inputs, pool_size=3, strides=2, padding='SAME', data_format=self._data_format)
        inputs = tf.identity(inputs, 'initial_max_pool')
        c2 = block_group(inputs=inputs, filters=64, strides=1, use_projection=True, block_fn=block_fn, block_repeats=layers[0], batch_norm_relu=self._batch_norm_relu, dropblock=self._dropblock, drop_connect_rate=get_drop_connect_rate(self._init_drop_connect_rate, 2, 5), name='block_group1', is_training=is_training)
        c3 = block_group(inputs=c2, filters=128, strides=2, use_projection=True, block_fn=block_fn, block_repeats=layers[1], batch_norm_relu=self._batch_norm_relu, dropblock=self._dropblock, drop_connect_rate=get_drop_connect_rate(self._init_drop_connect_rate, 3, 5), name='block_group2', is_training=is_training)
        c4 = block_group(inputs=c3, filters=256, strides=2, use_projection=True, block_fn=block_fn, block_repeats=layers[2], batch_norm_relu=self._batch_norm_relu, dropblock=self._dropblock, drop_connect_rate=get_drop_connect_rate(self._init_drop_connect_rate, 4, 5), name='block_group3', is_training=is_training)
        c5 = block_group(inputs=c4, filters=512, strides=2, use_projection=True, block_fn=block_fn, block_repeats=layers[3], batch_norm_relu=self._batch_norm_relu, dropblock=self._dropblock, drop_connect_rate=get_drop_connect_rate(self._init_drop_connect_rate, 5, 5), name='block_group4', is_training=is_training)
        return {2: c2, 3: c3, 4: c4, 5: c5}
    return model
Generator for ResNet v1 models.

Args:
  block_fn: `function` for the block to use within the model. Either
      `residual_block` or `bottleneck_block`.
  layers: list of 4 `int`s denoting the number of blocks to include in each
    of the 4 block groups. Each group consists of blocks that take inputs of
    the same resolution.

Returns:
  Model `function` that takes in `inputs` and `is_training` and returns the
  output `Tensor` of the ResNet model.
def resnet_v1_generator(self, block_fn, layers):
    'Generator for ResNet v1 models.\n\n    Args:\n      block_fn: `function` for the block to use within the model. Either\n          `residual_block` or `bottleneck_block`.\n      layers: list of 4 `int`s denoting the number of blocks to include in each\n        of the 4 block groups. Each group consists of blocks that take inputs of\n        the same resolution.\n\n    Returns:\n      Model `function` that takes in `inputs` and `is_training` and returns the\n      output `Tensor` of the ResNet model.\n    '

    def model(inputs, is_training=False):
        'Creation of the model graph.'
        inputs = nn_ops.conv2d_fixed_padding(inputs=inputs, filters=64, kernel_size=7, strides=2, data_format=self._data_format)
        inputs = tf.identity(inputs, 'initial_conv')
        inputs = self._batch_norm_relu(inputs, is_training=is_training)
        inputs = tf.layers.max_pooling2d(inputs=inputs, pool_size=3, strides=2, padding='SAME', data_format=self._data_format)
        inputs = tf.identity(inputs, 'initial_max_pool')
        c2 = block_group(inputs=inputs, filters=64, strides=1, use_projection=True, block_fn=block_fn, block_repeats=layers[0], batch_norm_relu=self._batch_norm_relu, dropblock=self._dropblock, drop_connect_rate=get_drop_connect_rate(self._init_drop_connect_rate, 2, 5), name='block_group1', is_training=is_training)
        c3 = block_group(inputs=c2, filters=128, strides=2, use_projection=True, block_fn=block_fn, block_repeats=layers[1], batch_norm_relu=self._batch_norm_relu, dropblock=self._dropblock, drop_connect_rate=get_drop_connect_rate(self._init_drop_connect_rate, 3, 5), name='block_group2', is_training=is_training)
        c4 = block_group(inputs=c3, filters=256, strides=2, use_projection=True, block_fn=block_fn, block_repeats=layers[2], batch_norm_relu=self._batch_norm_relu, dropblock=self._dropblock, drop_connect_rate=get_drop_connect_rate(self._init_drop_connect_rate, 4, 5), name='block_group3', is_training=is_training)
        c5 = block_group(inputs=c4, filters=512, strides=2, use_projection=True, block_fn=block_fn, block_repeats=layers[3], batch_norm_relu=self._batch_norm_relu, dropblock=self._dropblock, drop_connect_rate=get_drop_connect_rate(self._init_drop_connect_rate, 5, 5), name='block_group4', is_training=is_training)
        return {2: c2, 3: c3, 4: c4, 5: c5}
    return model