From 8eac2a46f7f6945cf2c553d8716be02b96791813 Mon Sep 17 00:00:00 2001 From: Yancey1989 Date: Thu, 12 Apr 2018 19:52:40 +0800 Subject: [PATCH] update by comment --- paddle/fluid/operators/uniform_random_op.cc | 6 ++++-- paddle/fluid/operators/uniform_random_op.cu | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/operators/uniform_random_op.cc b/paddle/fluid/operators/uniform_random_op.cc index 155690a6f46..acaefaacdaa 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 00011bbe619..e1c7323a302 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")); -- GitLab