123456789101112131415161718192021222324252627282930(** The module interface implemented by Recurrent Neural Networks. *)moduletypeS=sigtypettypestate(** [create vs ~input_dim ~hidden_size] creates a new RNN with the
specified input dimension and hidden size.
*)valcreate:Var_store.t->input_dim:int->hidden_size:int->t(** [step t state input_] applies one step of the RNN on the
given input using the specified state. The updated state is
returned.
*)valstep:t->state->Tensor.t->state(** [seq t inputs ~is_training] applies multiple steps of the RNN
starting from a zero state. The hidden states and the final state
are returned.
[inputs] should have shape [batch_size * timesteps * input_dim],
the returned output tensor then has shape
[batch_size * timesteps * hidden_size].
*)valseq:t->Tensor.t->is_training:bool->Tensor.t*state(** [zero_state t ~batch_size] returns an initial state to be used for
a RNN.
*)valzero_state:t->batch_size:int->stateend