tf.keras.backend.rnn( step_function, inputs, initial_states, go_backwards=False, mask=None, constants=None, unroll=False, input_length=None )
Iterates over the time dimension of a tensor.
step_function: RNN step function. Args; input; Tensor with shape
(samples, ...)(no time dimension), representing input for the batch of samples at a certain time step. states; List of tensors. Returns; output; Tensor with shape
(samples, output_dim)(no time dimension). new_states; List of tensors, same length and shapes as 'states'. The first state in the list must be the output tensor at the previous timestep.
inputs: Tensor of temporal data of shape
(samples, time, ...)(at least 3D).
initial_states: Tensor with shape
(samples, output_dim)(no time dimension), containing the initial values for the states used in the step function.
go_backwards: Boolean. If True, do the iteration over the time dimension in reverse order and return the reversed sequence.
mask: Binary tensor with shape
(samples, time, 1), with a zero for every element that is masked.
constants: List of constant values passed at each step.
unroll: Whether to unroll the RNN or to use a symbolic
input_length: If specified, assume time dimension is of this length.
(last_output, outputs, new_states).
last_output: the latest output of the rnn, of shape
outputs: tensor with shape
(samples, time, ...) where each
outputs[s, t] is the output of the step function
t for sample
new_states: list of tensors, latest states returned by
the step function, of shape
ValueError: if input dimension is less than 3.
Truebut input timestep is not a fixed number.
maskis provided (not
None) but states is not provided (