diff --git a/paddle/fluid/operators/lstm_unit_op.h b/paddle/fluid/operators/lstm_unit_op.h index 9faed3ca2ce4bec2cdff02993465bf32397e9338..99ae654d7ef0c42fb372bcd3305f14e9decd0075 100644 --- a/paddle/fluid/operators/lstm_unit_op.h +++ b/paddle/fluid/operators/lstm_unit_op.h @@ -39,8 +39,8 @@ template class LstmUnitKernel : public framework::OpKernel { public: void Compute(const framework::ExecutionContext& ctx) const override { - PADDLE_ENFORCE( - platform::is_cpu_place(ctx.GetPlace()), + PADDLE_ENFORCE_EQ( + platform::is_cpu_place(ctx.GetPlace()), true, paddle::platform::errors::PreconditionNotMet("It must use CPUPlace.")); auto* x_tensor = ctx.Input("X"); @@ -83,8 +83,8 @@ template class LstmUnitGradKernel : public framework::OpKernel { public: void Compute(const framework::ExecutionContext& ctx) const override { - PADDLE_ENFORCE( - platform::is_cpu_place(ctx.GetPlace()), + PADDLE_ENFORCE_EQ( + platform::is_cpu_place(ctx.GetPlace()), true, paddle::platform::errors::PreconditionNotMet("It must use CPUPlace.")); auto x_tensor = ctx.Input("X");