In fact, at the beginning of the decoding process, source = encoder_output and target = <BOS> are passed to the decoder and it produces token_1. After source = encoder_output and target = <BOS> token_1 are still passed to the model. The problem is that the decoder will produce a representation of shape [batch_size, 2, embed_dim], which we can then pass to the final classifier to have the output of shape [batch_size, 2, target_vocab_size], but we just select the last word of the seq_len (=2 here) dimension to have a final logits of shape [batch_size, target_vocab_size]. We can just do an argmax (resp. top_k for beam search…) on it (or do softmax before, it doesn’t change much) to get token_2 (resp. ), the index of the second token generated in the vocabulary.
You can ask me why we don’t just pass source = encoder_output and target = token_1 to have outputs logits of shape [batch_size, target_vocab_size] directly. This is usually due to the attention mechanism (here, masked one, because the decoder) : we need to produce a representation of token_1 taking into account all the tokens that precede it (here <BOS>), this representation is finally of shape [batch_size, embedding_dim], which we can just project on the classifier to have [batch_size, target_vocab_size] (if in your classifier you need to look again at the representation of the previous tokens, you can pass [batch_size, seq_len, embedding_dim] to the classifier to have [batch_size, embedding_dim, target_vocab_size] and choose the last token).
And this process continues until the index of the end-of-string symbol is generated
If you know a little bit about tensorflow, you can directly see how they illustrated it here during the validation of their model : Transformer model for language understanding  |  Text  |  TensorFlow 1
In pytorch, the one I use is this one, from facebook research XLM : XLM/transformer.py at master · facebookresearch/XLM · GitHub 1
There are many implementation of teacher forcing, beam search, … just google