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

Function _convert_stack_push_v2

tensorflow/python/ops/parallel_for/pfor.py:3045–3067  ·  view source on GitHub ↗
(pfor_input)

Source from the content-addressed store, hash-verified

3043
3044@RegisterPFor("StackPushV2")
3045def _convert_stack_push_v2(pfor_input):
3046 handle = pfor_input.unstacked_input(0)
3047 elem, elem_stacked, _ = pfor_input.input(1)
3048 swap_memory = pfor_input.get_attr("swap_memory")
3049
3050 if not _stack_handle_inside_pfor(pfor_input.op.inputs[0], pfor_input):
3051 raise ValueError("StackPushV2 not allowed on stacks created outside pfor")
3052 stack_cache_key = _stack_cache_key(pfor_input)
3053 stacked = _stack_cache.get(stack_cache_key, None)
3054 if stacked is None:
3055 stacked = elem_stacked
3056 _stack_cache[stack_cache_key] = stacked
3057 else:
3058 # If we previously made it unstacked then we can't revert to being stacked.
3059 if not stacked and elem_stacked:
3060 raise ValueError(
3061 "It looks like the stack was previously determined to be loop"
3062 " invariant, but we are now trying to push a loop dependent value"
3063 " to it. This is currently unsupported.")
3064 if stacked and not elem_stacked:
3065 elem = _stack(elem, pfor_input.pfor.loop_len_vector).t
3066 out = data_flow_ops.stack_push_v2(handle, elem, swap_memory=swap_memory)
3067 return wrap(out, stacked)
3068
3069
3070# Note that inputs to this convertor will be unstacked. However it should get

Callers

nothing calls this directly

Calls 8

_stack_cache_keyFunction · 0.85
_stackFunction · 0.85
unstacked_inputMethod · 0.80
wrapFunction · 0.70
inputMethod · 0.45
get_attrMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected