diff options
author | Piotr Padlewski <prazek@google.com> | 2018-09-14 11:28:28 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-14 11:32:52 -0700 |
commit | c20a7b81d79d30db9e990309ddb419bcb48120cc (patch) | |
tree | 9ea682cf79bac18653e7690785e0f5e7117b6b8b /tensorflow/core/framework/function_testlib.cc | |
parent | 89f9080ed0d1a43cb2fa253997b2553c6916f364 (diff) |
[tf.data] Introducing an optimization that parallelizes map transformations.
Stateless MapDatasets can be paralellized by switching to ParallelMapDataset. We set `num_parallel_calls` to 2 for now, but in the future a special value will be used that result in the optimal value to be selected dynamically at runtime.
This patch also exposed a memory leak which was fixed.
PiperOrigin-RevId: 213015223
Diffstat (limited to 'tensorflow/core/framework/function_testlib.cc')
-rw-r--r-- | tensorflow/core/framework/function_testlib.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tensorflow/core/framework/function_testlib.cc b/tensorflow/core/framework/function_testlib.cc index c5a4f661d2..d5c203d276 100644 --- a/tensorflow/core/framework/function_testlib.cc +++ b/tensorflow/core/framework/function_testlib.cc @@ -91,6 +91,40 @@ FunctionDef IsZero() { }); } +FunctionDef RandomUniform() { + const Tensor kZero = test::AsScalar<int64>(0); + const Tensor kTen = test::AsScalar<int64>(10); + + return FDH::Define( + // Name + "RandomUniform", + // Args + {"x: T"}, + // Return values + {"random_uniform: int64"}, + // Attr def + {"T:{float, double, int32, int64, string}"}, + {{{"random_uniform/shape"}, + "Const", + {}, + {{"value", kZero}, {"dtype", DT_INT64}}}, + {{"random_uniform/min"}, + "Const", + {}, + {{"value", kZero}, {"dtype", DT_INT64}}}, + {{"random_uniform/max"}, + "Const", + {}, + {{"value", kTen}, {"dtype", DT_INT64}}}, + {{"random_uniform"}, + "RandomUniformInt", + {}, + {{"T", DT_INT64}, + {"Tout", DT_INT64}, + {"seed", 87654321}, + {"seed2", 42}}}}); +} + FunctionDef XTimesTwo() { const Tensor kTwo = test::AsScalar<int64>(2); return FDH::Define( |