CyberZHG/keras-multi-head

Multi-head Attention with 2 Input Layers

Rmsharks4 opened this issue · 2 comments

Currently, if I use two layers as input to the Multi-Head Attention layer like so:
csr_atten = MultiHeadAttention(head_num=2)([csr_doc_layer, csr_intents_layer])
it throws out the following error:

ValueError: not enough values to unpack (expected 3, got 2)

Is there a workaround for using two input layers? Or is an alternative under development?

I found one work-around:

csr_doc_layer = Input(shape=(None, 200))
csr_intents_layer = Input(shape=(None, 11))
csr_concatenate_layer = Concatenate(axis=-1)([csr_doc_layer, csr_intents_layer])
csr_atten = MultiHeadAttention(head_num=211)([csr_doc_layer, csr_intents_layer, csr_concatenate_layer])

It works because this is the Input_value I'm looking for - but I'm not sure if its the best solution to this.

stale commented

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.