'Max pool across all nets in spatial dimensions.
Args:
nets_list: A list of 4D tensors with identical size.
Returns:
A tensor with the same size as any input tensors.'

def max_pool_views(self, nets_list):

    (batch_size, height, width, num_features) = [d.value for d in nets_list[0].get_shape().dims]
    xy_flat_shape = (batch_size, 1, (height * width), num_features)
    nets_for_merge = []
    with tf.variable_scope('max_pool_views', values=nets_list):
        for net in nets_list:
            nets_for_merge.append(tf.reshape(net, xy_flat_shape))
        merged_net = tf.concat(nets_for_merge, 1)
        net = slim.max_pool2d(merged_net, kernel_size=[len(nets_list), 1], stride=1)
        net = tf.reshape(net, (batch_size, height, width, num_features))
    return net
