From 1a690e6c7561cb591068d607af6a38cfaff60f1d Mon Sep 17 00:00:00 2001 From: Igor Ganichev Date: Mon, 18 Mar 2019 11:05:44 -0700 Subject: [PATCH] Test feeding device memory into host-memory expecting op in tf.function PiperOrigin-RevId: 239020830 --- tensorflow/compiler/tests/eager_test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tensorflow/compiler/tests/eager_test.py b/tensorflow/compiler/tests/eager_test.py index 632eccbb097..481efce751e 100644 --- a/tensorflow/compiler/tests/eager_test.py +++ b/tensorflow/compiler/tests/eager_test.py @@ -623,6 +623,17 @@ class EagerFunctionTest(xla_test.XLATestCase): r = f(elems) self.assertAllEqual([2., 4., 12., 48., 240., 1440.], self.evaluate(r)) + def testFeedDeviceMemoryToOpExpectingHostMemory(self): + @function.defun + def f(dims, value): + return array_ops.fill(dims, value) + + with self.test_scope(): + x = constant_op.constant([4], dtype=dtypes.int64) + + y = f(x, 3) + self.assertAllEqual([3, 3, 3, 3], y) + class ExcessivePaddingTest(xla_test.XLATestCase): """Test that eager execution works with TPU flattened tensors.