Design for TensorArray¶
TensorArray as a new concept is borrowed from TensorFlow,
it is meant to be used with dynamic iteration primitives such as while_loop
and map_fn
.
This concept can be used to support our new design of dynamic operations, and help to refactor some existing variant-sentence-related layers,
such as RecurrentGradientMachine
.
In our design for dynamic RNN,
TensorArray
is used to segment inputs and store states in all time steps.
By providing some methods similar to a C++ array,
the definition of some state-based dynamic models such as RNN could be more natural and highly flexible.