import tensorflow as tf

        tf.stop_gradient(indicator_matrix), distance_matrix,
        tf.fill(tf.shape(distance_matrix), distance_matrix.dtype.max))
    hard_distances = tf.math.reduce_min(distance_matrix, axis=-1)
    return hard_distances
