final_output, final_states = _recurrence(inputs, states)
last_output = C.sequence.last(final_output)
last_states = final_states
if need_convert:
final_output = C.sequence.unpack(final_output, 0, no_mask_output=True)
last_states = [
C.sequence.unpack(
s, 0, no_mask_output=True) for s in last_states]
if num_time_step is not None and num_time_step is not C.FreeDimension:
final_output = _reshape_sequence(final_output, num_time_step)
last_states = [
_reshape_sequence(
_, num_time_step) for _ in last_states]
return last_output, final_output, last_states