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)
| 255 | |
| 256 | # TODO(fkp): move this function in tf.Graph? |
| 257 | def 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 | |
| 275 | def make_list_of_t(ts, check_graph=True, allow_graph=True, ignore_ops=False): |
no test coverage detected