请按照下方说明实现 embedding()。
weight 为 float32 张量 (V, D),2 <= V <= 1000,1 <= D <= 256;indices 为 int64 张量 (S,),每个元素满足 0 <= idx < V。
基础查表
正确性调用
embedding(tensor[4], int64 [1,0,2,1], tensor[3, 3] [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, …])
预期结果
tensor[4, 3] [0.4, 0.5, 0.6, 0.1, 0.2, 0.3, …]
运行会检查可见示例,提交会运行完整的隐藏测试。
登录并提交后,你的提交记录会显示在这里。