From c0bf28ecc311759ac80e12515ad931b077aae635 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 21 May 2018 20:27:53 -0700 Subject: [PATCH] Update scan benchmarks to have a range of 16K-128K iterations. As of https://github.com/tensorflow/tensorflow/commit/5802096c267c805f6a69798aac10aefef759bb9f, TensorFlow Eager no longer exhibits quadratic behavior. The benchmark is still ~5x slower in eager mode vs. graph mode, and maybe slightly worse than linear: n Graph Time (s) Eager Time (s) Ratio ----------------------------------------------- 16K 0.35 1.8 5.1 32K 0.64 3.6 5.6 64K 1.1 7.2 6.5 128K 2.4 14.8 6.2 PiperOrigin-RevId: 197505257 --- .../eager/python/examples/scan/scan_graph_test.py | 17 +++++++---------- .../contrib/eager/python/examples/scan/scan_test.py | 16 +++++++--------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/tensorflow/contrib/eager/python/examples/scan/scan_graph_test.py b/tensorflow/contrib/eager/python/examples/scan/scan_graph_test.py index 4661daf..d4b8c89 100644 --- a/tensorflow/contrib/eager/python/examples/scan/scan_graph_test.py +++ b/tensorflow/contrib/eager/python/examples/scan/scan_graph_test.py @@ -38,20 +38,17 @@ class ScanBenchmark(tf.test.Benchmark): iters=n, wall_time=wall_time) + def benchmarkScan16000(self): + self.runScan(16000) + def benchmarkScan32000(self): self.runScan(32000) - def benchmarkScan1M(self): - self.runScan(1000000) - - def benchmarkScan2M(self): - self.runScan(2000000) - - def benchmarkScan4M(self): - self.runScan(4000000) + def benchmarkScan64000(self): + self.runScan(64000) - def benchmarkScan8M(self): - self.runScan(8000000) + def benchmarkScan128000(self): + self.runScan(128000) if __name__ == '__main__': tf.test.main() diff --git a/tensorflow/contrib/eager/python/examples/scan/scan_test.py b/tensorflow/contrib/eager/python/examples/scan/scan_test.py index b8c7cf1..a02fc24 100644 --- a/tensorflow/contrib/eager/python/examples/scan/scan_test.py +++ b/tensorflow/contrib/eager/python/examples/scan/scan_test.py @@ -36,21 +36,19 @@ class ScanBenchmark(tf.test.Benchmark): iters=n, wall_time=wall_time) - def benchmarkScan2000(self): - self.runScan(2000) - - def benchmarkScan4000(self): - self.runScan(4000) - - def benchmarkScan8000(self): - self.runScan(8000) - def benchmarkScan16000(self): self.runScan(16000) def benchmarkScan32000(self): self.runScan(32000) + def benchmarkScan64000(self): + self.runScan(64000) + + def benchmarkScan128000(self): + self.runScan(128000) + + if __name__ == '__main__': tf.enable_eager_execution() tf.test.main() -- 2.7.4