# tf.contrib.graph_editor.graph_replace

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/graph_editor/transform.py#L709-L752) |

Create a new graph which compute the targets from the replaced Tensors.

    tf.contrib.graph_editor.graph_replace(
        target_ts, replacement_ts, dst_scope='', src_scope='', reuse_dst_scope=False
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `target_ts` | a single tf.Tensor or an iterable of tf.Tensor. |
| `replacement_ts` | dictionary mapping from original tensors to replaced tensors |
| `dst_scope` | the destination scope. |
| `src_scope` | the source scope. |
| `reuse_dst_scope` | if True the dst_scope is re-used if it already exists. Otherwise, the scope is given a unique name based on the one given by appending an underscore followed by a digit (default). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A single tf.Tensor or a list of target tf.Tensor, depending on the type of the input argument `target_ts`. The returned tensors are recomputed using the tensors from replacement_ts. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | if the targets are not connected to replacement_ts. |

<br />