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

Method loop_fn

tensorflow/python/kernel_tests/rnn_cell_test.py:2074–2087  ·  view source on GitHub ↗
(time_, cell_output, cell_state, unused_loop_state)

Source from the content-addressed store, hash-verified

2072 cell = rnn_cell.LSTMCell(num_units, state_is_tuple=True)
2073
2074 def loop_fn(time_, cell_output, cell_state, unused_loop_state):
2075 emit_output = cell_output # == None for time == 0
2076 if cell_output is None: # time == 0
2077 next_state = cell.zero_state(batch_size, dtypes.float32)
2078 else:
2079 next_state = cell_state # copy state through
2080 elements_finished = (time_ >= sequence_length)
2081 finished = math_ops.reduce_all(elements_finished)
2082 # For the very final iteration, we must emit a dummy input
2083 next_input = control_flow_ops.cond(
2084 finished,
2085 lambda: array_ops.zeros([batch_size, input_depth], dtype=dtypes.float32),
2086 lambda: inputs_ta.read(time_))
2087 return (elements_finished, next_input, next_state, emit_output, None)
2088
2089 reuse_scope = variable_scope.get_variable_scope()
2090

Callers

nothing calls this directly

Calls 10

writeMethod · 0.95
readMethod · 0.95
tileMethod · 0.80
TensorArrayMethod · 0.80
onesMethod · 0.80
zero_stateMethod · 0.45
condMethod · 0.45
readMethod · 0.45
constantMethod · 0.45
stackMethod · 0.45

Tested by

no test coverage detected