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

Method testFreezeGraph

tensorflow/lite/python/lite_test.py:1148–1167  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1146 self.assertTrue(([1, 16, 16, 3] == input_details[0]['shape']).all())
1147
1148 def testFreezeGraph(self):
1149 with ops.Graph().as_default():
1150 in_tensor = array_ops.placeholder(
1151 shape=[1, 16, 16, 3], dtype=dtypes.float32)
1152 var = variable_scope.get_variable(
1153 'weights', shape=[1, 16, 16, 3], dtype=dtypes.float32)
1154 _ = in_tensor + var
1155 sess = session.Session()
1156
1157 # Write graph to file.
1158 graph_def_file = os.path.join(self.get_temp_dir(), 'model.pb')
1159 write_graph(sess.graph_def, '', graph_def_file, False)
1160 sess.close()
1161
1162 # Ensure the graph with variables cannot be converted.
1163 with self.assertRaises(ValueError) as error:
1164 lite.TFLiteConverter.from_frozen_graph(graph_def_file, ['Placeholder'],
1165 ['add'])
1166 self.assertEqual('Please freeze the graph using freeze_graph.py.',
1167 str(error.exception))
1168
1169 def testPbtxt(self):
1170 with ops.Graph().as_default():

Callers

nothing calls this directly

Calls 10

closeMethod · 0.95
get_temp_dirMethod · 0.80
write_graphFunction · 0.50
as_defaultMethod · 0.45
GraphMethod · 0.45
placeholderMethod · 0.45
get_variableMethod · 0.45
SessionMethod · 0.45
joinMethod · 0.45
from_frozen_graphMethod · 0.45

Tested by

no test coverage detected