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

Function _maybe_copy_some_through

tensorflow/python/ops/rnn.py:260–274  ·  view source on GitHub ↗

Run RNN step. Pass through either no or some past state.

()

Source from the content-addressed store, hash-verified

258 return flat_new_output + flat_new_state
259
260 def _maybe_copy_some_through():
261 """Run RNN step. Pass through either no or some past state."""
262 new_output, new_state = call_cell()
263
264 nest.assert_same_structure(zero_output, new_output)
265 nest.assert_same_structure(state, new_state)
266
267 flat_new_state = nest.flatten(new_state)
268 flat_new_output = nest.flatten(new_output)
269 return control_flow_ops.cond(
270 # if t < min_seq_len: calculate and return everything
271 time < min_sequence_length,
272 lambda: flat_new_output + flat_new_state,
273 # else copy some of it through
274 lambda: _copy_some_through(flat_new_output, flat_new_state))
275
276 # TODO(ebrevdo): skipping these conditionals may cause a slowdown,
277 # but benefits from removing cond() and its gradient. We should

Callers

nothing calls this directly

Calls 3

_copy_some_throughFunction · 0.70
flattenMethod · 0.45
condMethod · 0.45

Tested by

no test coverage detected