MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _ensure_same_dataset_graph

Function _ensure_same_dataset_graph

tensorflow/python/data/ops/dataset_ops.py:2128–2151  ·  view source on GitHub ↗

Walks the dataset graph to ensure all datasets come from the same graph.

(dataset)

Source from the content-addressed store, hash-verified

2126
2127
2128def _ensure_same_dataset_graph(dataset):
2129 """Walks the dataset graph to ensure all datasets come from the same graph."""
2130 current_graph = ops.get_default_graph()
2131 bfs_q = Queue.Queue()
2132 bfs_q.put(dataset) # pylint: disable=protected-access
2133 visited = []
2134 while not bfs_q.empty():
2135 ds = bfs_q.get()
2136 visited.append(ds)
2137 ds_graph = ds._graph # pylint: disable=protected-access
2138 if current_graph != ds_graph:
2139 logging.warning("The graph (" + str(current_graph) + ") of the iterator "
2140 "is different from the graph (" + str(ds_graph) + ") "
2141 "the dataset: " + str(ds._variant_tensor) + " was " # pylint: disable=protected-access
2142 "created in. If you are using the Estimator API, "
2143 "make sure that no part of the dataset returned by the "
2144 "`input_fn` function is defined outside the `input_fn` "
2145 "function. Please ensure that all datasets in the "
2146 "pipeline are created in the same graph as the iterator. "
2147 "NOTE: This warning will become an error in future "
2148 "versions of TensorFlow.")
2149 for input_ds in ds._inputs(): # pylint: disable=protected-access
2150 if input_ds not in visited:
2151 bfs_q.put(input_ds)
2152
2153
2154@tf_export(v1=["data.make_one_shot_iterator"])

Callers 2

Calls 6

QueueMethod · 0.80
putMethod · 0.45
emptyMethod · 0.45
getMethod · 0.45
appendMethod · 0.45
_inputsMethod · 0.45

Tested by

no test coverage detected