Copies a sub-meta_graph from one scope to another. Args: from_scope: `String` name scope containing the subgraph to be copied. to_scope: `String` name scope under which the copied subgraph will reside. from_graph: Optional `Graph` from which to copy the subgraph. If `None`, the
(from_scope, to_scope,
from_graph=None, to_graph=None)
| 1082 | |
| 1083 | |
| 1084 | def copy_scoped_meta_graph(from_scope, to_scope, |
| 1085 | from_graph=None, to_graph=None): |
| 1086 | """Copies a sub-meta_graph from one scope to another. |
| 1087 | |
| 1088 | Args: |
| 1089 | from_scope: `String` name scope containing the subgraph to be copied. |
| 1090 | to_scope: `String` name scope under which the copied subgraph will reside. |
| 1091 | from_graph: Optional `Graph` from which to copy the subgraph. If `None`, the |
| 1092 | default graph is use. |
| 1093 | to_graph: Optional `Graph` to which to copy the subgraph. If `None`, the |
| 1094 | default graph is used. |
| 1095 | |
| 1096 | Returns: |
| 1097 | A dictionary of `Variables` that has been copied into `to_scope`. |
| 1098 | |
| 1099 | Raises: |
| 1100 | ValueError: If `from_scope` and `to_scope` are the same while |
| 1101 | `from_graph` and `to_graph` are also the same. |
| 1102 | """ |
| 1103 | from_graph = from_graph or ops.get_default_graph() |
| 1104 | to_graph = to_graph or ops.get_default_graph() |
| 1105 | |
| 1106 | if from_graph == to_graph and from_scope == to_scope: |
| 1107 | raise ValueError("'from_scope' and 'to_scope' need to be different " |
| 1108 | "when performing copy in the same graph.") |
| 1109 | |
| 1110 | orig_meta_graph, var_list = export_scoped_meta_graph( |
| 1111 | export_scope=from_scope, graph=from_graph) |
| 1112 | var_list = import_scoped_meta_graph(orig_meta_graph, |
| 1113 | graph=to_graph, |
| 1114 | import_scope=to_scope) |
| 1115 | return var_list |
nothing calls this directly
no test coverage detected