tensor2tensor icon indicating copy to clipboard operation
tensor2tensor copied to clipboard

Question about Relative-Position-Representation code. Thank you very much.

Open guotong1988 opened this issue 5 years ago • 0 comments

In https://github.com/tensorflow/tensor2tensor/blob/master/tensor2tensor/layers/common_attention.py

image

x_t_r shape is [sequence_length, batch_size, hidden_size] z shape is [sequence_length, sequence_length, hidden_size]

then tf.matmul x_t_r and z to get a tensor with shape [batch_size, sequence_length, sequence_length], How To Understand This Line? How To Understand The Insight of This Line?

To be brief, I remove the heads in shape.

guotong1988 avatar Oct 14 '20 03:10 guotong1988