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

Function get_tensors

tensorflow/contrib/graph_editor/util.py:257–272  ·  view source on GitHub ↗

get all the tensors which are input or output of an op in the graph. Args: graph: a `tf.Graph`. Returns: A list of `tf.Tensor`. Raises: TypeError: if graph is not a `tf.Graph`.

(graph)

Source from the content-addressed store, hash-verified

255
256# TODO(fkp): move this function in tf.Graph?
257def get_tensors(graph):
258 """get all the tensors which are input or output of an op in the graph.
259
260 Args:
261 graph: a `tf.Graph`.
262 Returns:
263 A list of `tf.Tensor`.
264 Raises:
265 TypeError: if graph is not a `tf.Graph`.
266 """
267 if not isinstance(graph, tf_ops.Graph):
268 raise TypeError("Expected a graph, got: {}".format(type(graph)))
269 ts = []
270 for op in graph.get_operations():
271 ts += op.outputs
272 return ts
273
274
275def make_list_of_t(ts, check_graph=True, allow_graph=True, ignore_ops=False):

Callers 1

make_list_of_tFunction · 0.70

Calls 3

typeFunction · 0.85
get_operationsMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected