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

Function TransformGraph

tensorflow/tools/graph_transforms/__init__.py:27–54  ·  view source on GitHub ↗

Python wrapper for the Graph Transform Tool. Gives access to all graph transforms available through the command line tool. See documentation at https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/graph_transforms/README.md for full details of the options available. Args:

(input_graph_def, inputs, outputs, transforms)

Source from the content-addressed store, hash-verified

25
26
27def TransformGraph(input_graph_def, inputs, outputs, transforms):
28 """Python wrapper for the Graph Transform Tool.
29
30 Gives access to all graph transforms available through the command line tool.
31 See documentation at https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/graph_transforms/README.md
32 for full details of the options available.
33
34 Args:
35 input_graph_def: GraphDef object containing a model to be transformed.
36 inputs: List of node names for the model inputs.
37 outputs: List of node names for the model outputs.
38 transforms: List of strings containing transform names and parameters.
39
40 Returns:
41 New GraphDef with transforms applied.
42 """
43
44 input_graph_def_string = input_graph_def.SerializeToString()
45 inputs_string = compat.as_bytes(",".join(inputs))
46 outputs_string = compat.as_bytes(",".join(outputs))
47 transforms_string = compat.as_bytes(" ".join(transforms))
48 with errors.raise_exception_on_not_ok_status() as status:
49 output_graph_def_string = TransformGraphWithStringInputs(
50 input_graph_def_string, inputs_string, outputs_string,
51 transforms_string, status)
52 output_graph_def = graph_pb2.GraphDef()
53 output_graph_def.ParseFromString(output_graph_def_string)
54 return output_graph_def

Callers 2

testTransformGraphMethod · 0.90

Calls 3

SerializeToStringMethod · 0.45
joinMethod · 0.45
ParseFromStringMethod · 0.45

Tested by 2

testTransformGraphMethod · 0.72