@staticmethod
def spatial_dropout(in_tensor, keep_prob, evaluation):
    ' Spatial dropout: Not each neuron is dropped independently, but feature map wise. '
    with tf.variable_scope('spatial_dropout'):
        tensor_shape = in_tensor.get_shape().as_list()
        out_tensor = tf.cond(evaluation, (lambda : tf.nn.dropout(in_tensor, 1.0, noise_shape=tensor_shape)), (lambda : tf.nn.dropout(in_tensor, keep_prob, noise_shape=[tensor_shape[0], 1, 1, tensor_shape[3]])))
        return out_tensor
Spatial dropout: Not each neuron is dropped independently, but feature map wise.
@staticmethod
def spatial_dropout(in_tensor, keep_prob, evaluation):
    '  '
    with tf.variable_scope('spatial_dropout'):
        tensor_shape = in_tensor.get_shape().as_list()
        out_tensor = tf.cond(evaluation, (lambda : tf.nn.dropout(in_tensor, 1.0, noise_shape=tensor_shape)), (lambda : tf.nn.dropout(in_tensor, keep_prob, noise_shape=[tensor_shape[0], 1, 1, tensor_shape[3]])))
        return out_tensor