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

Function _handle_inside_pfor

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

Returns True if handle was created inside the pfor loop.

(pfor_input, handle)

Source from the content-addressed store, hash-verified

2748
2749
2750def _handle_inside_pfor(pfor_input, handle):
2751 """Returns True if handle was created inside the pfor loop."""
2752 # We use some heuristic to find the original TensorArray creation op.
2753 # The logic should handle the common cases (except cond based subgraphs).
2754 # In theory the user could perform different operations on the handle (like
2755 # Reshape, stack multiple handles, etc) which could break this logic.
2756 # TODO(agarwal): handle Switch/Merge.
2757 while handle.op.type in ("Enter", "Identity"):
2758 handle = handle.op.inputs[0]
2759 if handle.op.type not in [
2760 "TensorArrayV3", "TensorArrayGradV3", "TensorArrayGradWithShape"]:
2761 raise ValueError("Unable to find source for handle %s" % handle)
2762 else:
2763 return pfor_input.pfor.op_is_inside_loop(handle.op)
2764
2765
2766def _unstack_flow(value):

Calls 1

op_is_inside_loopMethod · 0.45

Tested by

no test coverage detected