pytorch-seq2seq
pytorch-seq2seq copied to clipboard
How to matrix multiply two encoded representations?
Lets say I have two encoders and they produce representations A and B. They are both of shape batch x seq len x hid dim. I want to combine these features. Is there a way to do a matrix multiplication such that my output is batch x seq len x hid dim. I am not sure there is. At the moment, I am just doing elementwise multiplication or addition
You can do what is done in the MultiHeadAttentionLayer and split the hid_dim into multiple "heads", but as it stands you have to do elementwise operations.
What are you trying to do? Some sort of attention mechanism?