MCPcopy Create free account
hub / github.com/alibaba/bigcomputing / _maybe_copy_some_through

Function _maybe_copy_some_through

DIEN/rnn.py:215–227  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

213 return flat_new_output + flat_new_state
214
215 def _maybe_copy_some_through():
216 """Run RNN step. Pass through either no or some past state."""
217 new_output, new_state = call_cell()
218
219 nest.assert_same_structure(state, new_state)
220
221 flat_new_state = nest.flatten(new_state)
222 flat_new_output = nest.flatten(new_output)
223 return control_flow_ops.cond(
224 # if t < min_seq_len: calculate and return everything
225 time < min_sequence_length, lambda: flat_new_output + flat_new_state,
226 # else copy some of it through
227 lambda: _copy_some_through(flat_new_output, flat_new_state))
228
229 # TODO(ebrevdo): skipping these conditionals may cause a slowdown,
230 # but benefits from removing cond() and its gradient. We should

Callers

nothing calls this directly

Calls 1

_copy_some_throughFunction · 0.85

Tested by

no test coverage detected