Type tf.graph_util
Namespace tensorflow
Methods
- convert_variables_to_constants
- convert_variables_to_constants
- convert_variables_to_constants
- convert_variables_to_constants
- convert_variables_to_constants_dyn
- extract_sub_graph
- extract_sub_graph
- extract_sub_graph
- extract_sub_graph_dyn
- must_run_on_cpu
- must_run_on_cpu
- must_run_on_cpu_dyn
- remove_training_nodes
- remove_training_nodes_dyn
- tensor_shape_from_node_def_name
- tensor_shape_from_node_def_name_dyn
Properties
Public static methods
object convert_variables_to_constants(BaseSession sess, Nullable<int> input_graph_def, IEnumerable<object> output_node_names, string variable_names_whitelist, IEnumerable<string> variable_names_blacklist)
Replaces all the variables in a graph with constants of the same values. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.convert_variables_to_constants` If you have a trained graph containing Variable ops, it can be convenient to
convert them all to Const ops holding the same values. This makes it possible
to describe the network fully with a single GraphDef file, and allows the
removal of a lot of ops related to loading and saving the variables.
Parameters
-
BaseSession
sess - Active TensorFlow session containing the variables.
-
Nullable<int>
input_graph_def - GraphDef object holding the network.
-
IEnumerable<object>
output_node_names - List of name strings for the result nodes of the graph.
-
string
variable_names_whitelist - The set of variable names to convert (by default, all variables are converted).
-
IEnumerable<string>
variable_names_blacklist - The set of variable names to omit converting to constants.
Returns
-
object
- GraphDef containing a simplified version of the original.
object convert_variables_to_constants(BaseSession sess, Nullable<int> input_graph_def, IEnumerable<object> output_node_names, string variable_names_whitelist, string variable_names_blacklist)
Replaces all the variables in a graph with constants of the same values. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.convert_variables_to_constants` If you have a trained graph containing Variable ops, it can be convenient to
convert them all to Const ops holding the same values. This makes it possible
to describe the network fully with a single GraphDef file, and allows the
removal of a lot of ops related to loading and saving the variables.
Parameters
-
BaseSession
sess - Active TensorFlow session containing the variables.
-
Nullable<int>
input_graph_def - GraphDef object holding the network.
-
IEnumerable<object>
output_node_names - List of name strings for the result nodes of the graph.
-
string
variable_names_whitelist - The set of variable names to convert (by default, all variables are converted).
-
string
variable_names_blacklist - The set of variable names to omit converting to constants.
Returns
-
object
- GraphDef containing a simplified version of the original.
object convert_variables_to_constants(BaseSession sess, Nullable<int> input_graph_def, IEnumerable<object> output_node_names, IEnumerable<string> variable_names_whitelist, IEnumerable<string> variable_names_blacklist)
Replaces all the variables in a graph with constants of the same values. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.convert_variables_to_constants` If you have a trained graph containing Variable ops, it can be convenient to
convert them all to Const ops holding the same values. This makes it possible
to describe the network fully with a single GraphDef file, and allows the
removal of a lot of ops related to loading and saving the variables.
Parameters
-
BaseSession
sess - Active TensorFlow session containing the variables.
-
Nullable<int>
input_graph_def - GraphDef object holding the network.
-
IEnumerable<object>
output_node_names - List of name strings for the result nodes of the graph.
-
IEnumerable<string>
variable_names_whitelist - The set of variable names to convert (by default, all variables are converted).
-
IEnumerable<string>
variable_names_blacklist - The set of variable names to omit converting to constants.
Returns
-
object
- GraphDef containing a simplified version of the original.
object convert_variables_to_constants(BaseSession sess, Nullable<int> input_graph_def, IEnumerable<object> output_node_names, IEnumerable<string> variable_names_whitelist, string variable_names_blacklist)
Replaces all the variables in a graph with constants of the same values. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.convert_variables_to_constants` If you have a trained graph containing Variable ops, it can be convenient to
convert them all to Const ops holding the same values. This makes it possible
to describe the network fully with a single GraphDef file, and allows the
removal of a lot of ops related to loading and saving the variables.
Parameters
-
BaseSession
sess - Active TensorFlow session containing the variables.
-
Nullable<int>
input_graph_def - GraphDef object holding the network.
-
IEnumerable<object>
output_node_names - List of name strings for the result nodes of the graph.
-
IEnumerable<string>
variable_names_whitelist - The set of variable names to convert (by default, all variables are converted).
-
string
variable_names_blacklist - The set of variable names to omit converting to constants.
Returns
-
object
- GraphDef containing a simplified version of the original.
object convert_variables_to_constants_dyn(object sess, object input_graph_def, object output_node_names, object variable_names_whitelist, object variable_names_blacklist)
Replaces all the variables in a graph with constants of the same values. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.convert_variables_to_constants` If you have a trained graph containing Variable ops, it can be convenient to
convert them all to Const ops holding the same values. This makes it possible
to describe the network fully with a single GraphDef file, and allows the
removal of a lot of ops related to loading and saving the variables.
Parameters
-
object
sess - Active TensorFlow session containing the variables.
-
object
input_graph_def - GraphDef object holding the network.
-
object
output_node_names - List of name strings for the result nodes of the graph.
-
object
variable_names_whitelist - The set of variable names to convert (by default, all variables are converted).
-
object
variable_names_blacklist - The set of variable names to omit converting to constants.
Returns
-
object
- GraphDef containing a simplified version of the original.
object extract_sub_graph(Nullable<int> graph_def, IEnumerable<string> dest_nodes)
Extract the subgraph that can reach any of the nodes in 'dest_nodes'. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.extract_sub_graph`
Parameters
-
Nullable<int>
graph_def - A graph_pb2.GraphDef proto.
-
IEnumerable<string>
dest_nodes - A list of strings specifying the destination node names.
Returns
-
object
- The GraphDef of the sub-graph.
object extract_sub_graph(Nullable<int> graph_def, object dest_nodes)
Extract the subgraph that can reach any of the nodes in 'dest_nodes'. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.extract_sub_graph`
Parameters
-
Nullable<int>
graph_def - A graph_pb2.GraphDef proto.
-
object
dest_nodes - A list of strings specifying the destination node names.
Returns
-
object
- The GraphDef of the sub-graph.
object extract_sub_graph(Nullable<int> graph_def, string dest_nodes)
Extract the subgraph that can reach any of the nodes in 'dest_nodes'. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.extract_sub_graph`
Parameters
-
Nullable<int>
graph_def - A graph_pb2.GraphDef proto.
-
string
dest_nodes - A list of strings specifying the destination node names.
Returns
-
object
- The GraphDef of the sub-graph.
object extract_sub_graph_dyn(object graph_def, object dest_nodes)
Extract the subgraph that can reach any of the nodes in 'dest_nodes'. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.extract_sub_graph`
Parameters
-
object
graph_def - A graph_pb2.GraphDef proto.
-
object
dest_nodes - A list of strings specifying the destination node names.
Returns
-
object
- The GraphDef of the sub-graph.
bool must_run_on_cpu(Operation node, bool pin_variables_on_cpu)
Returns True if the given node_def must run on CPU, otherwise False. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.must_run_on_cpu`
Parameters
-
Operation
node - The node to be assigned to a device. Could be either an ops.Operation or NodeDef.
-
bool
pin_variables_on_cpu - If True, this function will return False if node_def represents a variable-related op.
Returns
-
bool
- True if the given node must run on CPU, otherwise False.
bool must_run_on_cpu(object node, bool pin_variables_on_cpu)
Returns True if the given node_def must run on CPU, otherwise False. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.must_run_on_cpu`
Parameters
-
object
node - The node to be assigned to a device. Could be either an ops.Operation or NodeDef.
-
bool
pin_variables_on_cpu - If True, this function will return False if node_def represents a variable-related op.
Returns
-
bool
- True if the given node must run on CPU, otherwise False.
object must_run_on_cpu_dyn(object node, ImplicitContainer<T> pin_variables_on_cpu)
Returns True if the given node_def must run on CPU, otherwise False. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.must_run_on_cpu`
Parameters
-
object
node - The node to be assigned to a device. Could be either an ops.Operation or NodeDef.
-
ImplicitContainer<T>
pin_variables_on_cpu - If True, this function will return False if node_def represents a variable-related op.
Returns
-
object
- True if the given node must run on CPU, otherwise False.
object remove_training_nodes(object input_graph, IEnumerable<string> protected_nodes)
Prunes out nodes that aren't needed for inference. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.remove_training_nodes` There are nodes like Identity and CheckNumerics that are only useful
during training, and can be removed in graphs that will be used for
nothing but inference. Here we identify and remove them, returning an
equivalent graph. To be specific, CheckNumerics nodes are always removed, and
Identity nodes that aren't involved in control edges are spliced out so that
their input and outputs are directly connected.
Parameters
-
object
input_graph - Model to analyze and prune.
-
IEnumerable<string>
protected_nodes - An optional list of names of nodes to be kept unconditionally. This is for example useful to preserve Identity output nodes.
Returns
-
object
- A list of nodes with the unnecessary ones removed.
object remove_training_nodes_dyn(object input_graph, object protected_nodes)
Prunes out nodes that aren't needed for inference. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.remove_training_nodes` There are nodes like Identity and CheckNumerics that are only useful
during training, and can be removed in graphs that will be used for
nothing but inference. Here we identify and remove them, returning an
equivalent graph. To be specific, CheckNumerics nodes are always removed, and
Identity nodes that aren't involved in control edges are spliced out so that
their input and outputs are directly connected.
Parameters
-
object
input_graph - Model to analyze and prune.
-
object
protected_nodes - An optional list of names of nodes to be kept unconditionally. This is for example useful to preserve Identity output nodes.
Returns
-
object
- A list of nodes with the unnecessary ones removed.
string tensor_shape_from_node_def_name(object graph, object input_name)
Convenience function to get a shape from a NodeDef's input string. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.tensor_shape_from_node_def_name`
object tensor_shape_from_node_def_name_dyn(object graph, object input_name)
Convenience function to get a shape from a NodeDef's input string. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use `tf.compat.v1.graph_util.tensor_shape_from_node_def_name`