import tensorflow as tf

    self.assertAllEqual(labels_0_n.numpy(), expected_labels_0_n.numpy())

  def test_map_labels_to_0_to_n2(self):
    labels = tf.constant([[-1, 1, 2],
                          [1, 1, 2]], dtype=tf.int32)
    labels_0_n = isu.map_labels_to_0_to_n(labels)
    expected_labels_0_n = tf.constant([[-1, 0, 1],
                                       [0, 0, 1]], dtype=tf.int32)
    self.assertAllEqual(labels_0_n.numpy(), expected_labels_0_n.numpy())

  def test_randomly_select_one_point_per_segment(self):
    instance_labels = tf.constant([[1, 1, 1, 1, 1, 1, 1, 1],
                                   [1, 1, 2, 2, 2, 2, 2, 2],
                                   [1, 2, 2, 2, 2, 2, 2, 2],
                                   [0, 0, 0, 0, 2, 2, 2, 2],
                                   [0, 0, 0, 0, 2, 2, 2, 2]],
                                  dtype=tf.int32)
    instance_labels = tf.reshape(instance_labels, [-1])
    (indices,
     masks_t) = isu.randomly_select_one_point_per_segment(instance_labels)
    masks = tf.transpose(masks_t)
    masks = tf.reshape(masks, [3, 5, 8])
