All problems
Learned Positional Embedding Lookup
Problem
Learned positional embeddings are just an embedding table indexed by position.
Given the table as nested rows and a position, return the row.
Hint
Index the table directly, being careful to return a copy.
Test cases
case 1
in: [[[0.1,0.2],[0.3,0.4]],0]
expected: [0.1,0.2]
case 2
in: [[[1,2,3]],0]
expected: [1,2,3]
case 3
in: [[[5],[6],[7]],2]
expected: [7]
Starter codePython
def learned_positional_embedding_lookup(table, position):
# Your code here
pass3 test cases · run your code against them in the editor