MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / true_fn

Method true_fn

tensorflow/python/ops/parallel_for/pfor.py:507–525  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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,

Callers

nothing calls this directly

Calls 5

_convert_helperMethod · 0.80
appendMethod · 0.45
convertMethod · 0.45
control_dependenciesMethod · 0.45
identityMethod · 0.45

Tested by

no test coverage detected