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

Matrix API refactor #934

Merged
merged 2 commits into from
Dec 20, 2016
Merged

Conversation

tianbingsz
Copy link
Contributor

@tianbingsz tianbingsz commented Dec 16, 2016

When passing parameters, we use object reference or raw pointer instead of shared_ptr. (issue: #703)
The following API has been updated:
contextProjectionForward
contextProjectionBackward
contextProjectionBackwardData
contextProjectionBackwardWeight
classificationError
mul

Copy link
Contributor

@hedaoyuan hedaoyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面可以考虑一下如何把这几个写成Function的形式。Matrix::mul可以先不考虑,mul里面包含好几个分支。

virtual void contextProjectionForward(MatrixPtr input,
MatrixPtr weight,
virtual void contextProjectionForward(Matrix& input,
Matrix* weight,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matrix* -> Matrix&
后面的也一样,都用Matrix&就可以了。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main motivation to use Matrix * here is that we need to compare "if (weight)" in Matrix.cpp. It might be convenient to use raw pointer here instead of reference. What do you suggest?

xutianbing added 2 commits December 19, 2016 17:23
…rixPtr) to

reference or raw matrix (Matrix & or Matrix *)
contextProjectionForward
contextProjectionBackward
contextProjectionBackwardData
contextProjectionBackwardWeight
classificationError
The mul functions would be updated later.
@tianbingsz
Copy link
Contributor Author

Just add the refractor for mul

@tianbingsz tianbingsz changed the title Matrix API refactor, when passing parameters, convert shared_ptr (Mat… Matrix API refactor Dec 20, 2016
@tianbingsz tianbingsz merged commit 9049369 into PaddlePaddle:develop Dec 20, 2016
wangxicoding pushed a commit to wangxicoding/Paddle that referenced this pull request Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants