All problems
Multi Head Output Concatenation
Problem
Multi-head attention concatenates the per-head outputs along the feature dimension.
Given a list of head output vectors, return the concatenated vector.
Hint
Flatten the heads in order.
Test cases
case 1
in: [[[1,2],[3,4]]]
expected: [1,2,3,4]
case 2
in: [[[1],[2],[3]]]
expected: [1,2,3]
case 3
in: [[[],[1]]]
expected: [1]
Starter codePython
def multi_head_output_concatenation(heads):
# Your code here
pass3 test cases · run your code against them in the editor