Parses input tensorflow graph into GraphDef proto.
(input_graph, input_binary)
| 241 | |
| 242 | |
| 243 | def _parse_input_graph_proto(input_graph, input_binary): |
| 244 | """Parses input tensorflow graph into GraphDef proto.""" |
| 245 | if not gfile.Exists(input_graph): |
| 246 | raise IOError("Input graph file '" + input_graph + "' does not exist!") |
| 247 | input_graph_def = graph_pb2.GraphDef() |
| 248 | mode = "rb" if input_binary else "r" |
| 249 | with gfile.GFile(input_graph, mode) as f: |
| 250 | if input_binary: |
| 251 | input_graph_def.ParseFromString(f.read()) |
| 252 | else: |
| 253 | text_format.Merge(f.read(), input_graph_def) |
| 254 | return input_graph_def |
| 255 | |
| 256 | |
| 257 | def _parse_input_meta_graph_proto(input_graph, input_binary): |
no test coverage detected