diff --git a/paddle/fluid/operators/uniform_random_op.cc b/paddle/fluid/operators/uniform_random_op.cc index 155690a6f46b0dc4d417c1da443479dd702f72b5..acaefaacdaa593c090d81084fdc1b3665314833f 100644 --- a/paddle/fluid/operators/uniform_random_op.cc +++ b/paddle/fluid/operators/uniform_random_op.cc @@ -24,7 +24,7 @@ template class CPUUniformRandomKernel : public framework::OpKernel { public: void Compute(const framework::ExecutionContext& ctx) const override { - framework::Tensor* tensor(nullptr); + framework::Tensor* tensor = nullptr; auto out_var = ctx.OutputVar("Out"); if (out_var->IsType()) { tensor = out_var->GetMutable(); @@ -33,7 +33,9 @@ class CPUUniformRandomKernel : public framework::OpKernel { tensor = out_var->GetMutable()->mutable_value(); tensor->Resize(framework::make_ddim(shape)); } else { - PADDLE_THROW("Only support SelectedRows and Tensor"); + PADDLE_THROW( + "uniform_random_op's output only" + "supports SelectedRows and Tensor"); } T* data = tensor->mutable_data(ctx.GetPlace()); unsigned int seed = static_cast(ctx.Attr("seed")); diff --git a/paddle/fluid/operators/uniform_random_op.cu b/paddle/fluid/operators/uniform_random_op.cu index 00011bbe6193eba2445b6cb0daaca385d2c8f35d..e1c7323a30233f4ec4f60e46aa6088ee6d8601b7 100644 --- a/paddle/fluid/operators/uniform_random_op.cu +++ b/paddle/fluid/operators/uniform_random_op.cu @@ -43,7 +43,7 @@ template class GPUUniformRandomKernel : public framework::OpKernel { public: void Compute(const framework::ExecutionContext& context) const override { - framework::Tensor* tensor(nullptr); + framework::Tensor* tensor = nullptr; auto out_var = context.OutputVar("Out"); if (out_var->IsType()) { tensor = out_var->GetMutable(); @@ -52,7 +52,9 @@ class GPUUniformRandomKernel : public framework::OpKernel { tensor = out_var->GetMutable()->mutable_value(); tensor->Resize(framework::make_ddim(shape)); } else { - PADDLE_THROW("Only support SelectedRows and Tensor"); + PADDLE_THROW( + "uniform_random_op's output only" + "supports SelectedRows and Tensor"); } T* data = tensor->mutable_data(context.GetPlace()); unsigned int seed = static_cast(context.Attr("seed"));