Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paddle实现向量内积方法 #5496

Closed
ranqiu92 opened this issue Nov 8, 2017 · 1 comment · Fixed by #5724
Closed

paddle实现向量内积方法 #5496

ranqiu92 opened this issue Nov 8, 2017 · 1 comment · Fixed by #5724
Labels
User 用于标记用户问题

Comments

@ranqiu92
Copy link
Contributor

ranqiu92 commented Nov 8, 2017

paddle 目前提供的dotmul_operator是向量对应元素相乘的操作,没有对乘积进行求和。如何实现计算向量内积?

@ranqiu92
Copy link
Contributor Author

ranqiu92 commented Nov 8, 2017

可以使用 paddle.layer.linear_comb。

dot_product = paddle.layer.linear_comb(weights=layer1, vectors=layer2)

该layer原本实现的是矩阵与向量间的乘法,比较通用,实际使用时可以将向量作为矩阵,从而实现向量内积操作。因为该layer的通用性,在使用该layer计算向量内积时,耗时相对较长。

@chengduoZH chengduoZH added the User 用于标记用户问题 label Nov 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User 用于标记用户问题
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants