Returns intermediate tensors of `func_graph` for gradient computation.
(func_graph)
| 448 | |
| 449 | |
| 450 | def _get_intermediates(func_graph): |
| 451 | """Returns intermediate tensors of `func_graph` for gradient computation.""" |
| 452 | intermediates = [] |
| 453 | for op in func_graph.get_operations(): |
| 454 | for t in op.outputs: |
| 455 | if t in func_graph.inputs: continue |
| 456 | if t in func_graph.outputs: continue |
| 457 | if t.dtype is dtypes.resource: |
| 458 | continue |
| 459 | # Accumulating mutexes can cause deadlock. |
| 460 | if op.type == "MutexLock": |
| 461 | continue |
| 462 | intermediates.append(t) |
| 463 | return intermediates |
| 464 | |
| 465 | |
| 466 | def _make_intermediates_match(branch_graphs, branch_optionals): |
no test coverage detected