OK sorry I should have clarified this earlier.
I’m trying to replicate some experiments as described here: https://arxiv.org/abs/1810.13107 67
Basically the idea is like this: We have two seq2seq models chained together. The first seq2seq is anautomatic speech recognition (ASR) encoder-decoder model that takes a speech signal and outputs the corresponding text. Then the text is given to  a text-to-speech (TTS)  encoder-decoder model to generate back the speech signal from the generated text. You can imagine it like a seq2seq autoencoder model. There are two losses one after the ASR  which means we should backpropagate the gradients from the middle of the network to the beggining and the second loss is at the end which should backpropagate the gradients from the end all the way to the beggining (including the TTS model).
The problem is here, in order to generate the text we need to use argmax in the middle and since we need to backpropagate we need use straight-through estimator to prevent sending 0 gradients. The argmax is needed since the two seq2seq models will be decoupled later and each one should be usable independently.
Hope this clarifies,
Thanks for your help