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

Function _as_graph_element

tensorflow/contrib/learn/python/learn/monitors.py:1354–1375  ·  view source on GitHub ↗

Retrieves Graph element.

(obj)

Source from the content-addressed store, hash-verified

1352
1353
1354def _as_graph_element(obj):
1355 """Retrieves Graph element."""
1356 graph = ops.get_default_graph()
1357 if not isinstance(obj, six.string_types):
1358 if not hasattr(obj, "graph") or obj.graph != graph:
1359 raise ValueError("Passed %s should have graph attribute that is equal "
1360 "to current graph %s." % (obj, graph))
1361 return obj
1362 if ":" in obj:
1363 element = graph.as_graph_element(obj)
1364 else:
1365 element = graph.as_graph_element(obj + ":0")
1366 # Check that there is no :1 (e.g. it's single output).
1367 try:
1368 graph.as_graph_element(obj + ":1")
1369 except (KeyError, ValueError):
1370 pass
1371 else:
1372 raise ValueError("Name %s is ambiguous, "
1373 "as this `Operation` has multiple outputs "
1374 "(at least 2)." % obj)
1375 return element

Callers 1

before_runMethod · 0.70

Calls 1

as_graph_elementMethod · 0.80

Tested by

no test coverage detected