aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/common_runtime/memory_types_test.cc
diff options
context:
space:
mode:
authorGravatar Manjunath Kudlur <keveman@gmail.com>2016-04-02 11:55:59 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-04-02 13:02:16 -0700
commit0cd025b21cbf86efe4f8e09ad2677d15f45a6ff0 (patch)
tree465b64e05d87dac3ed590848d9ee254f3d8b4099 /tensorflow/core/common_runtime/memory_types_test.cc
parent4504be5df9383f744cae10b2dcde8f7ecf1fae7b (diff)
Enable constant folding in L0 optimization level.
Change: 118861866
Diffstat (limited to 'tensorflow/core/common_runtime/memory_types_test.cc')
-rw-r--r--tensorflow/core/common_runtime/memory_types_test.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/tensorflow/core/common_runtime/memory_types_test.cc b/tensorflow/core/common_runtime/memory_types_test.cc
index a5ac254494..9193ac85c7 100644
--- a/tensorflow/core/common_runtime/memory_types_test.cc
+++ b/tensorflow/core/common_runtime/memory_types_test.cc
@@ -52,4 +52,25 @@ TEST(MemoryTypeChecker, Int32NotOk) {
delete g;
}
+TEST(MemoryTypeChecker, MemoryTypeForOutput) {
+ Graph* g = new Graph(OpRegistry::Global());
+ Tensor vb(DT_BOOL, {});
+ Tensor vi(DT_INT32, {});
+ Tensor vf(DT_FLOAT, {});
+ auto pred = test::graph::Constant(g, vb);
+ auto si = test::graph::Switch(g, test::graph::Constant(g, vi), pred);
+ auto sf = test::graph::Switch(g, test::graph::Constant(g, vf), pred);
+ MemoryType memory_type;
+
+ TF_EXPECT_OK(MemoryTypeForOutput(DEVICE_CPU, g, sf, 0, &memory_type));
+ // float Switch's output on CPU doesn't have HOST_MEMORY constraint.
+ EXPECT_EQ(memory_type, DEVICE_MEMORY);
+#if GOOGLE_CUDA
+ TF_EXPECT_OK(MemoryTypeForOutput(DEVICE_GPU, g, si, 0, &memory_type));
+ // int Switch's output on GPU has HOST_MEMORY constraint.
+ EXPECT_EQ(memory_type, HOST_MEMORY);
+#endif // GOOGLE_CUDA
+ delete g;
+}
+
} // namespace