“词向量Word Embedding”教程的图3怎么体现了把Embedding Lookup的过程转换为张量计算?
“词向量Word Embedding”教程的图3怎么体现了把Embedding Lookup的过程转换为张量计算?与图2比较
https://www.paddlepaddle.org.cn/tutorials/projectdetail/1516149
/projectdetail/1516149
您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档、常见问题、历史Issue、AI社区来寻求解答。祝您生活愉快~
Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the API,FAQ,Github Issue and AI community to get the answer.Have a nice day!
可以认为每个词 都映射到了一个数字, 每个数字又对应着一组向量(就是Embedding Lookup里面每个横排),所以 我 爱 人工 等词语最终都对应着 一组向量。 为了让这个过程翻译成一个数学计算过程,就发明了onehot 也就是第二个矩阵。然后和第三个lookup就可以变成矩阵乘法。
“词向量Word Embedding”教程的图3怎么体现了把Embedding Lookup的过程转换为张量计算?与图2比较 https://www.paddlepaddle.org.cn/tutorials/projectdetail/1516149
/projectdetail/1516149
您好,感谢您使用本教程。关于您的问题回复如下:
这里是将语句中的词先进行one-hot编码表示,这样可以将这个词编码成一个向量,然后将这个向量和Embedding矩阵相乘,便可提取出该词对应的词向量。 举个例子,假设根据语料库生成的词典就是【我, 爱,人工,智能】,这4个词对应的id 依次是【0,1,2,3】。 以单词”人工”为例,他的one-hot编码可以表示成[0,0,1,0],因为one-hot编码这个向量中的除了”人工”这个单词的对应位置为1,其余全为0。
另外,假设我们的Embedding矩阵如下所示,其中每一行对应一个单词,每个单词的词向量对应有5个数值,例如”我”对应的是[0,0,0,0,0], 人工对应是[2,2,2,2,2]。 [ [0,0,0,0,0], [1,1,1,1,1], [2,2,2,2,2], [3,3,3,3,3] ]
当使用上边的”人工”的one-hot向量与这个矩阵相乘时,便可以便直接可以获得向量:[2,2,2,2,2], 相当于使用这种矩阵相乘的方式,直接提取除了”人工”对应的词向量。
此外,为了便于大家理解,教程中的图形进行了符号修改,指向更加明确些。
Since you haven't replied for more than a year, we have closed this issue/pr. If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. 由于您超过一年未回复,我们将关闭这个issue/pr。 若问题未解决或有后续问题,请随时重新打开,我们会继续跟进。