I guess you can call it a trick, but note that it really informs the decoder about the
output length, which doesn't have to be the same as the input length! I'm not sure where you think we could lose information -- as you said, the whole input sequence is encoded in the squashed vector, but how well this can be done depends on many factors, among them the dimensionality of this vector (
hidden_dim), the properties of the data, etc.
I also don't quite understand your last sentence "Because without this trick...". Without RepeatVector(), you simply could not train with target sequences longer than 1 element, because the shape of the training data would not match the expected output shape of the model.
- Marcel