diff options
author | 2017-01-30 21:09:16 -0800 | |
---|---|---|
committer | 2017-01-30 21:34:48 -0800 | |
commit | 8691453b900aef43bf4a3966a5a96b14fbb7bfc3 (patch) | |
tree | 50f653d76cda5ca6d1daaa258ed39f52bcd5c571 /tensorflow/contrib/stat_summarizer | |
parent | 643fc7712fcedd1252eae855e4e89fc642cf0426 (diff) |
StatSummarizer: Make it work without needing the GraphDef.
This will allow the StatSummarizer to be instantiated and used
even when the GraphDef is not easily accessible. A consequence of
this is that the BY_DEFINITION_ORDER ordering of stats is no
longer available, but that was deemed acceptable for this change.
Other notables:
- Added a basic C++ unittest for stat_summarizer.
- Added some commentary about caveats about summaries over runs
that involve GPUs or partitioned graphs. These caveats existed
in the prior implementation as well.
Change: 146076563
Diffstat (limited to 'tensorflow/contrib/stat_summarizer')
-rw-r--r-- | tensorflow/contrib/stat_summarizer/python/stat_summarizer_test.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tensorflow/contrib/stat_summarizer/python/stat_summarizer_test.py b/tensorflow/contrib/stat_summarizer/python/stat_summarizer_test.py index b66e7cd537..e4db5f2e3c 100644 --- a/tensorflow/contrib/stat_summarizer/python/stat_summarizer_test.py +++ b/tensorflow/contrib/stat_summarizer/python/stat_summarizer_test.py @@ -31,9 +31,9 @@ class StatSummarizerTest(test.TestCase): def testStatSummarizer(self): with ops.Graph().as_default() as graph: - matrix1 = constant_op.constant([[3., 3.]]) - matrix2 = constant_op.constant([[2.], [2.]]) - product = math_ops.matmul(matrix1, matrix2) + matrix1 = constant_op.constant([[3., 3.]], name=r"m1") + matrix2 = constant_op.constant([[2.], [2.]], name=r"m2") + product = math_ops.matmul(matrix1, matrix2, name=r"product") graph_def = graph.as_graph_def() ss = pywrap_tensorflow.NewStatSummarizer(graph_def.SerializeToString()) @@ -59,8 +59,12 @@ class StatSummarizerTest(test.TestCase): # Test that a header line got printed. self.assertRegexpMatches(output_string, r"====== .* ======") - # Test that the MatMul node we added was analyzed. - self.assertRegexpMatches(output_string, r"MatMul") + # Test that the nodes we added were analyzed. + # The line for the op should contain both the op type (MatMul) + # and the name of the node (product) + self.assertRegexpMatches(output_string, r"MatMul.*product") + self.assertRegexpMatches(output_string, r"Const.*m1") + self.assertRegexpMatches(output_string, r"Const.*m2") # Test that a CDF summed to 100% self.assertRegexpMatches(output_string, r"100\.") |