From 2d4c66d4b2bc723d2404d650b1adbd3b76a42b32 Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Thu, 10 Aug 2017 13:42:27 +0800 Subject: [PATCH] add comments and todo lists --- paddle/gserver/layers/MKLDNNFcLayer.h | 3 +++ paddle/gserver/tests/MKLDNNTester.cpp | 12 +++++++----- paddle/gserver/tests/MKLDNNTester.h | 9 +++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/paddle/gserver/layers/MKLDNNFcLayer.h b/paddle/gserver/layers/MKLDNNFcLayer.h index dffae27d7..7954852a2 100644 --- a/paddle/gserver/layers/MKLDNNFcLayer.h +++ b/paddle/gserver/layers/MKLDNNFcLayer.h @@ -29,7 +29,10 @@ protected: // 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_; // fc weight and bias diff --git a/paddle/gserver/tests/MKLDNNTester.cpp b/paddle/gserver/tests/MKLDNNTester.cpp index d91e4ed60..99c8c4948 100644 --- a/paddle/gserver/tests/MKLDNNTester.cpp +++ b/paddle/gserver/tests/MKLDNNTester.cpp @@ -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(); @@ -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; + // } } } diff --git a/paddle/gserver/tests/MKLDNNTester.h b/paddle/gserver/tests/MKLDNNTester.h index d21f92d42..522eeaf24 100644 --- a/paddle/gserver/tests/MKLDNNTester.h +++ b/paddle/gserver/tests/MKLDNNTester.h @@ -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 }; protected: @@ -107,7 +107,8 @@ private: * 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. */ double getDelta(const real* d1, const real* d2, -- GitLab