Returns t or Identity(t) whichever exists in graph outputs else None.
(t)
| 788 | assert isinstance(tensor.graph, func_graph_module.FuncGraph) |
| 789 | |
| 790 | def get_func_graph_output(t): |
| 791 | """Returns t or Identity(t) whichever exists in graph outputs else None.""" |
| 792 | for output in tensor.graph.outputs: |
| 793 | if output is t: |
| 794 | return t |
| 795 | # tf.defun adds an Identity for each output, check whether that is the case. |
| 796 | identity_op = t.consumers()[0] |
| 797 | if (identity_op.type == "Identity" and |
| 798 | identity_op.outputs[0] in tensor.graph.outputs): |
| 799 | return identity_op.outputs[0] |
| 800 | return None |
| 801 | |
| 802 | for consumer in tensor.consumers(): |
| 803 | # Find the consumer that is a TensorListPushBack node whose TensorList input |
no test coverage detected