def resnet_bottleneck_v1()

in benchmarks/horovod-resnet/train_imagenet_resnet_hvd.py [0:0]


def resnet_bottleneck_v1(builder, inputs, depth, depth_bottleneck, stride, basic=False):
    num_inputs = inputs.get_shape().as_list()[1]
    x = inputs
    with tf.name_scope("resnet_v1"):
        if depth == num_inputs:
            if stride == 1:
                shortcut = x
            else:
                shortcut = builder.max_pooling2d(x, 1, stride)
        else:
            shortcut = builder.conv2d_linear(x, depth, 1, stride, "SAME")
        if basic:
            x = builder.pad2d(x, 1)
            x = builder.conv2d(x, depth_bottleneck, 3, stride, "VALID")
            x = builder.conv2d_linear(x, depth, 3, 1, "SAME")
        else:
            x = builder.conv2d(x, depth_bottleneck, 1, 1, "SAME")
            x = builder.conv2d(x, depth_bottleneck, 3, stride, "SAME")
            # x = builder.conv2d_linear(x, depth,            1, 1,      'SAME')
            x = builder.conv2d_linear_last_bn(x, depth, 1, 1, "SAME")
        x = tf.nn.relu(x + shortcut)
        return x