コード例 #1
0
def after(interval_set_a: tf.Tensor, interval_set_b: tf.Tensor) -> tf.Tensor:
    cross = all_combinations(interval_set_a, interval_set_b)

    indices = tf.reshape(tf.where(cross[:, 0] > cross[:, 3]), [
        -1,
    ])

    result = tf.gather(cross, indices)[:, 0:2]

    if len(result) > 1:
        result = u2d.tf_unique_2d(result)

    return result
コード例 #2
0
def equal(interval_set_a: tf.Tensor, interval_set_b: tf.Tensor) -> tf.Tensor:
    cross = all_combinations(interval_set_a, interval_set_b)

    indices = tf.reshape(
        tf.where(
            tf.logical_and(cross[:, 0] == cross[:, 2],
                           cross[:, 1] == cross[:, 3])), [
                               -1,
                           ])

    result = tf.gather(cross, indices)[:, 0:2]

    if len(result) > 1:
        result = u2d.tf_unique_2d(result)

    return result