I am using the Transformer module in pytorch from the paper "Attention is All You Need". On page 5, the authors state that
In our model, we share the same weight matrix between the two embedding layers and the pre-softmax linear transformation, similar to [30]. (page 5)
The embedding layer, at least in pytorch, is a learnable tensor whose columns are the embedding vectors corresponding to each word. My confusion stems from the fact that in the paper, the Transformer learns a translation task between languages (i.e. English to German). Thus, how could the embedding weights be shared for the English and German embedding vectors?
In addition, how could the weights be shared between the output embedding (which goes from word index to embedding vector) and the linear layer (which goes from embedding vector to word probabilities)? As far as I can tell there is no constraint requiring the embedding tensor must be orthogonal (so that its inverse is its transpose).