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

add resize of MKLDNNMatrix #5543

Merged
merged 1 commit into from
Nov 12, 2017
Merged

add resize of MKLDNNMatrix #5543

merged 1 commit into from
Nov 12, 2017

Conversation

tensor-tang
Copy link
Contributor

Add resize function of MKLDNNMatrix to fix the check failed when batch size changed.

@luotao1
Copy link
Contributor

luotao1 commented Nov 10, 2017

check failed when batch size changed

能具体说一下fail是什么情况么?

@tensor-tang
Copy link
Contributor Author

tensor-tang commented Nov 10, 2017

主要是在reset的时候,比如有的网络在train过程中batchsize会变化,或者是图像的大小会变化。
这个时候会调用resetOutput,最后会调用到matrix->resize(height, width);
https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/math/Matrix.cpp#L176

这时的matrix已经是MKLDNNMatrix了,但是会调用CpuMatrix::resize,只改了data的地址,但是后面MKLDNNMatrix调用getData的时候就会出现CHECK fail了,所以只需要实现一个MKLDNNMatrix::resize去override点CpuMatrix::resize就可以了。

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

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

LGTM

@luotao1 luotao1 merged commit 1c31bb9 into PaddlePaddle:develop Nov 12, 2017
@tensor-tang tensor-tang deleted the ds2 branch November 12, 2017 12:12
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.

2 participants