Test a session has debug info captured.
(self)
| 1053 | interpreter.invoke() |
| 1054 | |
| 1055 | def testGraphDebugInfo(self): |
| 1056 | """Test a session has debug info captured.""" |
| 1057 | |
| 1058 | @def_function.function |
| 1059 | def plus_placeholder(x, placeholder): |
| 1060 | return x + placeholder |
| 1061 | |
| 1062 | with ops.Graph().as_default(): |
| 1063 | placeholder = array_ops.placeholder( |
| 1064 | dtype=dtypes.float32, shape=[1], name='input') |
| 1065 | variable_node = variables.Variable(1.0, name='variable_node') |
| 1066 | defun_node = plus_placeholder(variable_node, placeholder) |
| 1067 | output_node = math_ops.multiply(defun_node, 2.0, name='output_node') |
| 1068 | |
| 1069 | # Initialize variables in the model. |
| 1070 | sess = session.Session() |
| 1071 | sess.run(variables.variables_initializer([variable_node])) |
| 1072 | |
| 1073 | converter = lite.TFLiteConverter.from_session(sess, [placeholder], |
| 1074 | [output_node]) |
| 1075 | converter.convert() |
| 1076 | self.assertValidDebugInfo(converter._debug_info) |
| 1077 | |
| 1078 | # Check the add node in the inlined function is included. |
| 1079 | func = sess.graph.as_graph_def().library.function[0].signature.name |
| 1080 | self.assertIn((func + 'add'), converter._debug_info.traces) |
| 1081 | |
| 1082 | |
| 1083 | class FromFrozenGraphFile(test_util.TensorFlowTestCase): |
nothing calls this directly
no test coverage detected