# tf.contrib.copy_graph.copy_op_to_graph

<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/copy_graph/python/util/copy_elements.py#L101-L230) |

Returns a copy of an operation from another Graph under a specified scope.

    tf.contrib.copy_graph.copy_op_to_graph(
        org_instance, to_graph, variables, scope=''
    )

Given an `Operation` `org_instance` from one `Graph`,
initializes and returns a copy of it from another `Graph`,
under the specified scope (default `""`).

The copying is done recursively, so any `Operation` whose output
is required to evaluate the `org_instance`, is also copied (unless
already done).

Since `Variable` instances are copied separately, those required
to evaluate `org_instance` must be provided as input.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `org_instance` | An `Operation` from some `Graph`. Could be a `Placeholder` as well. |
| `to_graph` | The `Graph` to copy `org_instance` to. |
| `variables` | An iterable of `Variable` instances to copy `org_instance` to. |
| `scope` | A scope for the new `Variable` (default `""`). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The copied `Operation` from `to_graph`. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | If `org_instance` is not an `Operation` or `Tensor`. |

<br />