tf.compat.v1.graph_util.remove_training_nodes  |  TensorFlow v2.16.1 (original) (raw)

tf.compat.v1.graph_util.remove_training_nodes

Stay organized with collections Save and categorize content based on your preferences.

Prunes out nodes that aren't needed for inference. (deprecated)

tf.compat.v1.graph_util.remove_training_nodes(
    input_graph, protected_nodes=None
)

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.

Args
input_graph Model to analyze and prune.
protected_nodes An optional list of names of nodes to be kept unconditionally. This is for example useful to preserve Identity output nodes.
Returns
A list of nodes with the unnecessary ones removed.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.

Last updated 2024-04-26 UTC.