Exemplo n.º 1
0
        def graph_fn():
            y_source = tf.constant([1.5, 0.3], dtype=tf.float32)
            x_source = tf.constant([2.5, 4.2], dtype=tf.float32)
            (offsets, indices) = ta_utils.compute_floor_offsets_with_indices(
                y_source, x_source)

            return offsets, indices
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
  def test_compute_floor_offsets_with_indices_onlysource(self):
    y_source = tf.constant([1.5, 0.3], dtype=tf.float32)
    x_source = tf.constant([2.5, 4.2], dtype=tf.float32)
    (offsets,
     indices) = ta_utils.compute_floor_offsets_with_indices(y_source, x_source)

    np.testing.assert_array_almost_equal(offsets.numpy(),
                                         np.array([[0.5, 0.5], [0.3, 0.2]]))
    np.testing.assert_array_almost_equal(indices.numpy(),
                                         np.array([[1, 2], [0, 4]]))
Exemplo n.º 4
0
  def test_compute_floor_offsets_with_indices_and_targets(self):
    y_source = tf.constant([1.5, 0.3], dtype=tf.float32)
    x_source = tf.constant([2.5, 4.2], 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)

    np.testing.assert_array_almost_equal(offsets.numpy(),
                                         np.array([[1.1, -0.8], [0.1, 0.5]]))
    np.testing.assert_array_almost_equal(indices.numpy(),
                                         np.array([[1, 2], [0, 4]]))