Converts the body function for all but last iteration. This essentially converts body_output. Additionally, it needs to handle any control dependencies on the NextIteration node. So it creates another Identity node with the converted dependencies.
(control_inputs, body_pfor, body_output, stacked)
| 505 | """Convert the body function.""" |
| 506 | |
| 507 | def true_fn(control_inputs, body_pfor, body_output, stacked): |
| 508 | """Converts the body function for all but last iteration. |
| 509 | |
| 510 | This essentially converts body_output. Additionally, it needs to handle |
| 511 | any control dependencies on the NextIteration node. So it creates another |
| 512 | Identity node with the converted dependencies. |
| 513 | """ |
| 514 | converted_control_inp = [] |
| 515 | for x in control_inputs: |
| 516 | for t in x.outputs: |
| 517 | converted_control_inp.append(body_pfor._convert_helper(t).t) |
| 518 | if stacked: |
| 519 | # Note convert always does the stacking. |
| 520 | output = body_pfor.convert(body_output) |
| 521 | else: |
| 522 | output, convert_stacked, _ = body_pfor._convert_helper(body_output) |
| 523 | assert convert_stacked == stacked, body_output |
| 524 | with ops.control_dependencies(converted_control_inp): |
| 525 | return array_ops.identity(output) |
| 526 | |
| 527 | body_pfor = self._init_pfor(pfor_input.pfor, new_indices, |
| 528 | cond_stacked, new_inputs, |
nothing calls this directly
no test coverage detected