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

Function get_tensors

tensorflow/python/ops/op_selector.py:62–77  ·  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

60
61
62def get_tensors(graph):
63 """get all the tensors which are input or output of an op in the graph.
64
65 Args:
66 graph: a `tf.Graph`.
67 Returns:
68 A list of `tf.Tensor`.
69 Raises:
70 TypeError: if graph is not a `tf.Graph`.
71 """
72 if not isinstance(graph, ops.Graph):
73 raise TypeError("Expected a graph, got: {}".format(type(graph)))
74 ts = []
75 for op in graph.get_operations():
76 ts += op.outputs
77 return ts
78
79
80def get_unique_graph(tops, check_types=None, none_if_empty=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