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)
| 60 | |
| 61 | |
| 62 | def 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 | |
| 80 | def get_unique_graph(tops, check_types=None, none_if_empty=False): |
no test coverage detected