You are referring to the right tutorial page (tutorial/NeuralNetworksSequenceLearning#1680168479 : subsection "Integer Addition with Variable-Length Output" of "Sequence-to-Sequence Learning").
So you should also define an architecture in two parts: an encoderNet
, which encodes your input string, and a decoderNet
which generates the next output token given the previous generated ones (starting with a special token which means "nothing generated yet", and that can generate a special token to stop the generation).
That is the way to generate variable-length sequences with neural networks. There is no special output layer that can generate sequences of different lengths.