This has already been explored in (Gu et al., 2018) in the context of Machine Translation.
our problem is simpler because the size of the output is always twice the size of the input, in other words we do not have to estimate the size of the output.