From 74f76e61d885dcc0478086c54ad330875b92bbd4 Mon Sep 17 00:00:00 2001 From: dangqingqing Date: Mon, 9 Jan 2017 10:30:39 +0800 Subject: [PATCH] update code and fix bug --- paddle/function/PadOp.cpp | 12 ++++++------ paddle/function/PadOpTest.cpp | 2 +- paddle/gserver/tests/test_LayerGrad.cpp | 8 +++----- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/paddle/function/PadOp.cpp b/paddle/function/PadOp.cpp index 2dfe03dcf..ff13f27e9 100644 --- a/paddle/function/PadOp.cpp +++ b/paddle/function/PadOp.cpp @@ -92,9 +92,9 @@ public: void calc(const Arguments& inputs, const Arguments& outputs, const Arguments& inouts) override { - CHECK_EQ(1, inputs.size()); - CHECK_EQ(1, outputs.size()); - CHECK_EQ(0, inouts.size()); + CHECK_EQ(1UL, inputs.size()); + CHECK_EQ(1UL, outputs.size()); + CHECK_EQ(0UL, inouts.size()); size_t num = inputs[0].dims_[0]; size_t inC = inputs[0].dims_[1]; @@ -143,9 +143,9 @@ public: void calc(const Arguments& inputs, const Arguments& outputs, const Arguments& inouts) override { - CHECK_EQ(1, inputs.size()); - CHECK_EQ(0, outputs.size()); - CHECK_EQ(1, inouts.size()); + CHECK_EQ(1UL, inputs.size()); + CHECK_EQ(0UL, outputs.size()); + CHECK_EQ(1UL, inouts.size()); size_t n = inouts[0].dims_[0]; size_t inC = inouts[0].dims_[1]; diff --git a/paddle/function/PadOpTest.cpp b/paddle/function/PadOpTest.cpp index c6d573c1d..be989807d 100644 --- a/paddle/function/PadOpTest.cpp +++ b/paddle/function/PadOpTest.cpp @@ -62,7 +62,7 @@ TEST(PadGrad, real) { Dims inDims{numSamples, channels, imgSizeH, imgSizeW}; Dims outDims{numSamples, channels + 5, imgSizeH + 3, imgSizeW + 5}; compare.cmpWithArg( - {Tensor(nullptr, inDims)}, {}, {Tensor(nullptr, outDims)}); + {Tensor(nullptr, outDims)}, {}, {Tensor(nullptr, inDims)}); } } } diff --git a/paddle/gserver/tests/test_LayerGrad.cpp b/paddle/gserver/tests/test_LayerGrad.cpp index 0560bb3ed..8c8e876bd 100644 --- a/paddle/gserver/tests/test_LayerGrad.cpp +++ b/paddle/gserver/tests/test_LayerGrad.cpp @@ -850,15 +850,13 @@ TEST(Layer, SequenceLastInstanceLayer) { testDegradeLayer(true, "seqlastins", "non-seq"); // hasSubseq seqlastins to non-seq - testDegradeLayer(true, "seqlastins", "seq"); // hasSubseq seqlastins to - seq + testDegradeLayer(true, "seqlastins", "seq"); // hasSubseq seqlastins to seq } TEST(Layer, AverageLayer) { testDegradeLayer(false, "average", "non-seq"); // seq average to non-seq - testDegradeLayer(true, "average", "non-seq"); // hasSubseq average to - non - - seq testDegradeLayer(true, "average", "seq"); // hasSubseq average to seq + testDegradeLayer(true, "average", "non-seq"); // hasSubseq average to non-seq + testDegradeLayer(true, "average", "seq"); // hasSubseq average to seq } TEST(Layer, SequenceConcatLayer) { -- GitLab