diff options
Diffstat (limited to 'tensorflow/python/eager/tensor_test.py')
-rw-r--r-- | tensorflow/python/eager/tensor_test.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tensorflow/python/eager/tensor_test.py b/tensorflow/python/eager/tensor_test.py index 32742a9b96..344a9b25bd 100644 --- a/tensorflow/python/eager/tensor_test.py +++ b/tensorflow/python/eager/tensor_test.py @@ -31,6 +31,7 @@ from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import test_util +from tensorflow.python.ops import array_ops def _create_tensor(value, device=None, dtype=None): @@ -333,6 +334,19 @@ class TFETensorUtilTest(test_util.TensorFlowTestCase): "but tensor at index 2 has rank 0"): pywrap_tensorflow.TFE_Py_TensorShapeSlice([t2, t1, t3], 0) + @test_util.assert_no_new_pyobjects_executing_eagerly + def testTensorDir(self): + t = array_ops.zeros(1) + t.test_attr = "Test" + + instance_dir = dir(t) + type_dir = dir(ops.EagerTensor) + + # Monkey patched attributes should show up in dir(t) + self.assertIn("test_attr", instance_dir) + instance_dir.remove("test_attr") + self.assertEqual(instance_dir, type_dir) + if __name__ == "__main__": test.main() |