def body(time, elements_finished, current_input, emit_ta, state, loop_state):
    'Internal while loop body for raw_rnn.\n\n      Args:\n        time: time scalar.\n        elements_finished: batch-size vector.\n        current_input: possibly nested tuple of input tensors.\n        emit_ta: possibly nested tuple of output TensorArrays.\n        state: possibly nested tuple of state tensors.\n        loop_state: possibly nested tuple of loop state tensors.\n\n      Returns:\n        Tuple having the same size as Args but with updated values.\n      '
    (next_output, cell_state) = cell(current_input, state)
    nest.assert_same_structure(state, cell_state)
    nest.assert_same_structure(cell.output_size, next_output)
    next_time = (time + 1)
    (next_finished, next_input, next_state, emit_output, next_loop_state) = loop_fn(next_time, next_output, cell_state, loop_state)
    nest.assert_same_structure(state, next_state)
    nest.assert_same_structure(current_input, next_input)
    nest.assert_same_structure(emit_ta, emit_output)
    loop_state = (loop_state if (next_loop_state is None) else next_loop_state)

    def _copy_some_through(current, candidate):
        'Copy some tensors through via array_ops.where.'
        current_flat = nest.flatten(current)
        candidate_flat = nest.flatten(candidate)
        result_flat = [_on_device((lambda : array_ops.where(elements_finished, current_i, candidate_i)), device=candidate_i.op.device) for (current_i, candidate_i) in zip(current_flat, candidate_flat)]
        return nest.pack_sequence_as(structure=current, flat_sequence=result_flat)
    emit_output = _copy_some_through(zero_emit, emit_output)
    next_state = _copy_some_through(state, next_state)
    emit_output_flat = nest.flatten(emit_output)
    emit_ta_flat = nest.flatten(emit_ta)
    elements_finished = math_ops.logical_or(elements_finished, next_finished)
    emit_ta_flat = [ta.write(time, emit) for (ta, emit) in zip(emit_ta_flat, emit_output_flat)]
    emit_ta = nest.pack_sequence_as(structure=emit_structure, flat_sequence=emit_ta_flat)
    return (next_time, elements_finished, next_input, emit_ta, next_state, loop_state)
Internal while loop body for raw_rnn.

Args:
  time: time scalar.
  elements_finished: batch-size vector.
  current_input: possibly nested tuple of input tensors.
  emit_ta: possibly nested tuple of output TensorArrays.
  state: possibly nested tuple of state tensors.
  loop_state: possibly nested tuple of loop state tensors.

Returns:
  Tuple having the same size as Args but with updated values.
def body(time, elements_finished, current_input, emit_ta, state, loop_state):
    'Internal while loop body for raw_rnn.\n\n      Args:\n        time: time scalar.\n        elements_finished: batch-size vector.\n        current_input: possibly nested tuple of input tensors.\n        emit_ta: possibly nested tuple of output TensorArrays.\n        state: possibly nested tuple of state tensors.\n        loop_state: possibly nested tuple of loop state tensors.\n\n      Returns:\n        Tuple having the same size as Args but with updated values.\n      '
    (next_output, cell_state) = cell(current_input, state)
    nest.assert_same_structure(state, cell_state)
    nest.assert_same_structure(cell.output_size, next_output)
    next_time = (time + 1)
    (next_finished, next_input, next_state, emit_output, next_loop_state) = loop_fn(next_time, next_output, cell_state, loop_state)
    nest.assert_same_structure(state, next_state)
    nest.assert_same_structure(current_input, next_input)
    nest.assert_same_structure(emit_ta, emit_output)
    loop_state = (loop_state if (next_loop_state is None) else next_loop_state)

    def _copy_some_through(current, candidate):
        'Copy some tensors through via array_ops.where.'
        current_flat = nest.flatten(current)
        candidate_flat = nest.flatten(candidate)
        result_flat = [_on_device((lambda : array_ops.where(elements_finished, current_i, candidate_i)), device=candidate_i.op.device) for (current_i, candidate_i) in zip(current_flat, candidate_flat)]
        return nest.pack_sequence_as(structure=current, flat_sequence=result_flat)
    emit_output = _copy_some_through(zero_emit, emit_output)
    next_state = _copy_some_through(state, next_state)
    emit_output_flat = nest.flatten(emit_output)
    emit_ta_flat = nest.flatten(emit_ta)
    elements_finished = math_ops.logical_or(elements_finished, next_finished)
    emit_ta_flat = [ta.write(time, emit) for (ta, emit) in zip(emit_ta_flat, emit_output_flat)]
    emit_ta = nest.pack_sequence_as(structure=emit_structure, flat_sequence=emit_ta_flat)
    return (next_time, elements_finished, next_input, emit_ta, next_state, loop_state)