|
22 | 22 |
|
23 | 23 | from tensorflow.core.framework import step_stats_pb2 |
24 | 24 | from tensorflow.core.protobuf import config_pb2 |
| 25 | +from tensorflow.core.protobuf import rewriter_config_pb2 |
25 | 26 | from tensorflow.python.client import session |
26 | 27 | from tensorflow.python.debug.cli import debugger_cli_common |
27 | 28 | from tensorflow.python.debug.cli import profile_analyzer_cli |
|
35 | 36 | from tensorflow.python.util import tf_inspect |
36 | 37 |
|
37 | 38 |
|
| 39 | +def no_rewrite_session_config(): |
| 40 | + rewriter_config = rewriter_config_pb2.RewriterConfig( |
| 41 | + disable_model_pruning=True, |
| 42 | + constant_folding=rewriter_config_pb2.RewriterConfig.OFF) |
| 43 | + graph_options = config_pb2.GraphOptions(rewrite_options=rewriter_config) |
| 44 | + return config_pb2.ConfigProto(graph_options=graph_options) |
| 45 | + |
| 46 | + |
38 | 47 | def _line_number_above(): |
39 | 48 | return tf_inspect.stack()[1][2] - 1 |
40 | 49 |
|
@@ -146,7 +155,7 @@ def testWithSession(self): |
146 | 155 | options.trace_level = config_pb2.RunOptions.FULL_TRACE |
147 | 156 | run_metadata = config_pb2.RunMetadata() |
148 | 157 |
|
149 | | - with session.Session() as sess: |
| 158 | + with session.Session(config=no_rewrite_session_config()) as sess: |
150 | 159 | a = constant_op.constant([1, 2, 3]) |
151 | 160 | b = constant_op.constant([2, 2, 1]) |
152 | 161 | result = math_ops.add(a, b) |
|
0 commit comments