def test_compute_floor_offsets_with_indices_multisources(self):

    def graph_fn():
        y_source = tf.constant([[1.0, 0.0], [2.0, 3.0]], dtype=tf.float32)
        x_source = tf.constant([[2.0, 4.0], [3.0, 3.0]], dtype=tf.float32)
        y_target = tf.constant([2.1, 0.1], dtype=tf.float32)
        x_target = tf.constant([1.2, 4.5], dtype=tf.float32)
        (offsets, indices) = ta_utils.compute_floor_offsets_with_indices(y_source, x_source, y_target, x_target)
        return (offsets, indices)
    (offsets, indices) = self.execute(graph_fn, [])
    np.testing.assert_array_almost_equal(offsets[:, 0, :], np.array([[1.1, (- 0.8)], [(- 1.9), 1.5]]))
    np.testing.assert_array_almost_equal(offsets[:, 1, :], np.array([[2.1, (- 2.8)], [(- 2.9), 1.5]]))
    np.testing.assert_array_almost_equal(indices[:, 0, :], np.array([[1, 2], [2, 3]]))
    np.testing.assert_array_almost_equal(indices[:, 1, :], np.array([[0, 4], [3, 3]]))
def test_compute_floor_offsets_with_indices_multisources(self):

    def graph_fn():
        y_source = tf.constant([[1.0, 0.0], [2.0, 3.0]], dtype=tf.float32)
        x_source = tf.constant([[2.0, 4.0], [3.0, 3.0]], dtype=tf.float32)
        y_target = tf.constant([2.1, 0.1], dtype=tf.float32)
        x_target = tf.constant([1.2, 4.5], dtype=tf.float32)
        (offsets, indices) = ta_utils.compute_floor_offsets_with_indices(y_source, x_source, y_target, x_target)
        return (offsets, indices)
    (offsets, indices) = self.execute(graph_fn, [])
    np.testing.assert_array_almost_equal(offsets[:, 0, :], np.array([[1.1, (- 0.8)], [(- 1.9), 1.5]]))
    np.testing.assert_array_almost_equal(offsets[:, 1, :], np.array([[2.1, (- 2.8)], [(- 2.9), 1.5]]))
    np.testing.assert_array_almost_equal(indices[:, 0, :], np.array([[1, 2], [2, 3]]))
    np.testing.assert_array_almost_equal(indices[:, 1, :], np.array([[0, 4], [3, 3]]))