Run RNN step. Pass through either no or some past state.
()
| 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 |
nothing calls this directly
no test coverage detected