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.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.compat.v1.graph_util.remove_training_nodes\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/framework/graph_util_impl.py#L279-L376) |\n\nPrunes out nodes that aren't needed for inference. (deprecated) \n\n tf.compat.v1.graph_util.remove_training_nodes(\n input_graph, protected_nodes=None\n )\n\n| **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: This API was designed for TensorFlow v1. See \u003chttps://www.tensorflow.org/guide/migrate\u003e for instructions on how to migrate your code to TensorFlow v2.\n\nThere are nodes like Identity and CheckNumerics that are only useful\nduring training, and can be removed in graphs that will be used for\nnothing but inference. Here we identify and remove them, returning an\nequivalent graph. To be specific, CheckNumerics nodes are always removed, and\nIdentity nodes that aren't involved in control edges are spliced out so that\ntheir input and outputs are directly connected.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------------|------------------------------------------------------------------------------------------------------------------------------|\n| `input_graph` | Model to analyze and prune. |\n| `protected_nodes` | An optional list of names of nodes to be kept unconditionally. This is for example useful to preserve Identity output nodes. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A list of nodes with the unnecessary ones removed. ||\n\n\u003cbr /\u003e"]]