To give more clarity, the complete transformer architecture with the encoder and decoder is shown in the following figure:
Figure 1.63 – Encoder and decoder of the transformer
In the preceding figure, Nx denotes that we can stack number of encoders and decoders. As we can observe, once we feed the input sentence (source sentence), the encoder learns the representation and sends the representation to the decoder, which in turn generates the output sentence (target sentence).