'Unroll an RNN cell across time steps.
Parameters
length : int
Number of steps to unroll.
inputs : Symbol, list of Symbol, or None
If `inputs` is a single Symbol (usually the output
of Embedding symbol), it should have shape
(batch_size, length, ...) if layout == \'NTC\',
or (length, batch_size, ...) if layout == \'TNC\'.
If `inputs` is a list of symbols (usually output of
previous unroll), they should all have shape
(batch_size, ...).
begin_state : nested list of Symbol, default None
Input states created by `begin_state()`
or output state of another cell.
Created from `begin_state()` if None.
layout : str, optional
`layout` of input symbol. Only used if inputs
is a single Symbol.
merge_outputs : bool, optional
If False, return outputs as a list of Symbols.
If True, concatenate output across time steps
and return a single symbol with shape
(batch_size, length, ...) if layout == \'NTC\',
or (length, batch_size, ...) if layout == \'TNC\'.
If None, output whatever is faster.
Returns
outputs : list of Symbol or Symbol
Symbol (if `merge_outputs` is True) or list of Symbols
(if `merge_outputs` is False) corresponding to the output from
the RNN from this unrolling.
states : nested list of Symbol
The new state of this RNN after this unrolling.
The type of this symbol is same as the output of begin_state().'

def unroll(self, length, inputs, begin_state=None, layout='NTC', merge_outputs=None):

    self.reset()
    (inputs, _) = _normalize_sequence(length, inputs, layout, False)
    if (begin_state is None):
        begin_state = self.begin_state()
    states = begin_state
    outputs = []
    for i in range(length):
        (output, states) = self(inputs[i], states)
        outputs.append(output)
    (outputs, _) = _normalize_sequence(length, outputs, layout, merge_outputs)
    return (outputs, states)
