Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions paddle/gserver/layers/MKLDNNFcLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ class MKLDNNFcLayer : public MKLDNNLayer {
// input layer size, can not be change after init
size_t iLayerSize_; // == ic * ih * iw

// if has already init the weight
bool hasInitedWgt_;

// if input layer has image size info (ih>1 && iw>1)
bool hasSpatial_;
Copy link
Contributor

@luotao1 luotao1 Aug 10, 2017

Choose a reason for hiding this comment

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

照注释的意思,这个变量改成:hasImgSizeInfo_类似的更加直观。或者其他名字也可。


// fc weight and bias
Expand Down
12 changes: 7 additions & 5 deletions paddle/gserver/tests/MKLDNNTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ void MKLDNNTester::checkForward() {
}

void MKLDNNTester::checkBackwardData() {
const bool isBN = dnnLayer_->getType() == "mkldnn_batch_norm";
// TODO(TJ): uncomment me when batch norm ready
// const bool isBN = dnnLayer_->getType() == "mkldnn_batch_norm";
for (size_t i = 0; i < dataLayers_[DNN].size(); ++i) {
const MatrixPtr& dnnDiff = dataLayers_[DNN][i]->getOutputGrad();
const MatrixPtr& refDiff = dataLayers_[REF][i]->getOutputGrad();
Expand All @@ -134,10 +135,11 @@ void MKLDNNTester::checkBackwardData() {

double delta = compareMatrix(dnnDiff, refDiff);
EXPECT_LE(fabs(delta), eps_);
if (isBN) {
// the other two inputs in batch norm are for moving mean and var
break;
}
// TODO(TJ): uncomment me when batch norm ready
// if (isBN) {
// // the other two inputs in batch norm are for moving mean and var
// break;
// }
}
}

Expand Down
9 changes: 5 additions & 4 deletions paddle/gserver/tests/MKLDNNTester.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ namespace paddle {
*/
class MKLDNNTester {
enum {
DNN = 0,
REF = 1,
NUM = 2,
DNN = 0, // MKLDNN layer
REF = 1, // Reference layer
NUM = 2, // Number of total
Copy link
Contributor

Choose a reason for hiding this comment

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

total是啥?Number of MKLDNN layer and Reference layer?

};

protected:
Expand Down Expand Up @@ -107,7 +107,8 @@ class MKLDNNTester {
* Get delta percent
* if many(>failRate) wrong(abs(dnn-ref)/abs(ref)>thres) points return the
* max(diff/ref)
* else return sum(abs(a-b)) / sum(abs(b)) should smaller than eps
* else return sum(abs(a-b)) / sum(abs(b))
* The return value should smaller than eps when passing.
Copy link
Contributor

Choose a reason for hiding this comment

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

The return value should be (缺少动词)

*/
double getDelta(const real* d1,
const real* d2,
Expand Down