MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / testGraphDebugInfo

Method testGraphDebugInfo

tensorflow/lite/python/lite_test.py:1055–1080  ·  view source on GitHub ↗

Test a session has debug info captured.

(self)

Source from the content-addressed store, hash-verified

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
1083class FromFrozenGraphFile(test_util.TensorFlowTestCase):

Callers

nothing calls this directly

Calls 11

runMethod · 0.95
VariableMethod · 0.80
multiplyMethod · 0.80
assertValidDebugInfoMethod · 0.80
as_graph_defMethod · 0.80
as_defaultMethod · 0.45
GraphMethod · 0.45
placeholderMethod · 0.45
SessionMethod · 0.45
from_sessionMethod · 0.45
convertMethod · 0.45

Tested by

no test coverage detected