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

Function make_list_of_t

tensorflow/python/ops/op_selector.py:134–161  ·  view source on GitHub ↗

Convert ts to a list of `tf.Tensor`. Args: ts: can be an iterable of `tf.Tensor`, a `tf.Graph` or a single tensor. check_graph: if `True` check if all the tensors belong to the same graph. allow_graph: if `False` a `tf.Graph` cannot be converted. ignore_ops: if `True`, silently ig

(ts, check_graph=True, allow_graph=True, ignore_ops=False)

Source from the content-addressed store, hash-verified

132
133
134def make_list_of_t(ts, check_graph=True, allow_graph=True, ignore_ops=False):
135 """Convert ts to a list of `tf.Tensor`.
136
137 Args:
138 ts: can be an iterable of `tf.Tensor`, a `tf.Graph` or a single tensor.
139 check_graph: if `True` check if all the tensors belong to the same graph.
140 allow_graph: if `False` a `tf.Graph` cannot be converted.
141 ignore_ops: if `True`, silently ignore `tf.Operation`.
142 Returns:
143 A newly created list of `tf.Tensor`.
144 Raises:
145 TypeError: if `ts` cannot be converted to a list of `tf.Tensor` or,
146 if `check_graph` is `True`, if all the ops do not belong to the same graph.
147 """
148 if isinstance(ts, ops.Graph):
149 if allow_graph:
150 return get_tensors(ts)
151 else:
152 raise TypeError("allow_graph is False: cannot convert a tf.Graph.")
153 else:
154 if not is_iterable(ts):
155 ts = [ts]
156 if not ts:
157 return []
158 if check_graph:
159 check_types = None if ignore_ops else ops.Tensor
160 get_unique_graph(ts, check_types=check_types)
161 return [t for t in ts if isinstance(t, ops.Tensor)]
162
163
164def get_generating_ops(ts):

Callers 3

get_generating_opsFunction · 0.70
get_consuming_opsFunction · 0.70
get_backward_walk_opsFunction · 0.70

Calls 3

get_tensorsFunction · 0.70
is_iterableFunction · 0.70
get_unique_graphFunction · 0.70

Tested by

no test coverage detected