diff --git a/paddle/fluid/operators/activation_op.h b/paddle/fluid/operators/activation_op.h index 28329bce6e3988cc9a0d6b88f30e9a19a232a8fb..6e906d734e1ac630fe4b5a43695a987942df3063 100644 --- a/paddle/fluid/operators/activation_op.h +++ b/paddle/fluid/operators/activation_op.h @@ -1598,7 +1598,7 @@ struct ELUGradGradFunctor : public BaseActivationFunctor { auto dout = framework::EigenVector::Flatten( GET_DATA_SAFELY(dOut, "Output", "DOut", "ELUGradGrad")); dx.device(*d) = ddx * dout * static_cast(alpha) * x.exp() * - (x < static_cast(0)).template cast(); + (x <= static_cast(0)).template cast(); } if (ddOut) { diff --git a/paddle/fluid/operators/prroi_pool_op.h b/paddle/fluid/operators/prroi_pool_op.h index 5ec846c147373911281b04c79dc32a43171ddca0..11ecff8845216df6c6e07f5a7ccc2212d742167f 100644 --- a/paddle/fluid/operators/prroi_pool_op.h +++ b/paddle/fluid/operators/prroi_pool_op.h @@ -293,19 +293,24 @@ class CPUPRROIPoolOpKernel : public framework::OpKernel { } else { PADDLE_ENFORCE_EQ(rois->lod().empty(), false, platform::errors::InvalidArgument( - "the lod of Input ROIs should not be empty when " + "The lod of Input ROIs should not be empty when " "BatchRoINums is None!")); auto rois_lod = rois->lod().back(); int rois_batch_size = rois_lod.size() - 1; - PADDLE_ENFORCE_EQ( - rois_batch_size, batch_size, - platform::errors::InvalidArgument("the rois_batch_size and input(X) " - "batch_size should be the same.")); + PADDLE_ENFORCE_EQ(rois_batch_size, batch_size, + platform::errors::InvalidArgument( + "The rois_batch_size and input(X)'s " + "batch_size should be the same but received" + "rois_batch_size: %d and batch_size: %d", + rois_batch_size, batch_size)); int rois_num_with_lod = rois_lod[rois_batch_size]; PADDLE_ENFORCE_EQ( rois_num_with_lod, rois_num, - platform::errors::InvalidArgument( - "the rois_num from input and lod must be the same")); + platform::errors::InvalidArgument("The rois_num from input should be " + "equal to the rois_num from lod, " + "but received rois_num from input: " + "%d and the rois_num from lod: %d.", + rois_num_with_lod, rois_num)); // calculate batch id index for each roi according to LoD for (int n = 0; n < rois_batch_size; ++n) { diff --git a/python/paddle/fluid/tests/unittests/test_activation_nn_grad.py b/python/paddle/fluid/tests/unittests/test_activation_nn_grad.py index 9c5f580d81d20b2bbc34efc0bf71b1fe9b432f38..cfa487a8354cf839676f6fdc35a196dbcf40568d 100644 --- a/python/paddle/fluid/tests/unittests/test_activation_nn_grad.py +++ b/python/paddle/fluid/tests/unittests/test_activation_nn_grad.py @@ -78,9 +78,9 @@ class TestLeakyReluDoubleGradCheck(unittest.TestCase): class TestELUDoubleGradCheck(unittest.TestCase): @prog_scope() def func(self, place): - shape = [2, 3, 6, 6] + shape = [2, 4, 4, 4] eps = 1e-6 - alpha = 1.1 + alpha = 0.2 dtype = np.float64 SEED = 0