From 649bcd5fe23a903d77fb10697157876a6f4d9cc5 Mon Sep 17 00:00:00 2001 From: silingtong123 <35439432+silingtong123@users.noreply.github.com> Date: Mon, 30 Sep 2019 09:39:57 +0800 Subject: [PATCH] Modify the style of function names (#20071) --- paddle/fluid/operators/uniform_random_op.cc | 10 +++++----- paddle/fluid/operators/uniform_random_op.cu | 4 ++-- paddle/fluid/operators/uniform_random_op.h | 9 ++++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/paddle/fluid/operators/uniform_random_op.cc b/paddle/fluid/operators/uniform_random_op.cc index 619350771a8..c704a494665 100644 --- a/paddle/fluid/operators/uniform_random_op.cc +++ b/paddle/fluid/operators/uniform_random_op.cc @@ -33,9 +33,9 @@ class CPUUniformRandomKernel : public framework::OpKernel { if (list_new_shape_tensor.size() > 0 || ctx.HasInput("ShapeTensor")) { if (ctx.HasInput("ShapeTensor")) { auto *shape_tensor = ctx.Input("ShapeTensor"); - new_shape = get_new_data_from_shape_tensor(shape_tensor); + new_shape = GetNewDataFromShapeTensor(shape_tensor); } else if (list_new_shape_tensor.size() > 0) { - new_shape = get_new_shape_from_shape_tensorlist(list_new_shape_tensor); + new_shape = GetNewDataFromShapeTensorList(list_new_shape_tensor); } } @@ -169,14 +169,14 @@ class UniformRandomOpMaker : public framework::OpProtoAndCheckerMaker { AddInput("ShapeTensor", "(Tensor, optional). If provided, uniform_ranodom " "according to " - "this given shape. That is to say it has a higher priority than " + "this given shape. It means that it has a higher priority than " "the shape attribute, while the shape attribute still should be " "set correctly to gurantee shape inference in compile time.") .AsDispensable(); AddInput("ShapeTensorList", "(vector>, optional). If provided, uniform_random " - "will use this" - "The shape of the tensor in vector MUST BE [1]" + "use this." + "The shape of the tensor in vector MUST BE [1]," "it has the highest priority compare with Input(Shape) and " "attr(shape).") .AsDuplicable() diff --git a/paddle/fluid/operators/uniform_random_op.cu b/paddle/fluid/operators/uniform_random_op.cu index 46b0576ecd1..53c79cf672e 100644 --- a/paddle/fluid/operators/uniform_random_op.cu +++ b/paddle/fluid/operators/uniform_random_op.cu @@ -64,9 +64,9 @@ class GPUUniformRandomKernel : public framework::OpKernel { if (list_new_shape_tensor.size() > 0 || context.HasInput("ShapeTensor")) { if (context.HasInput("ShapeTensor")) { auto* shape_tensor = context.Input("ShapeTensor"); - new_shape = get_new_data_from_shape_tensor(shape_tensor); + new_shape = GetNewDataFromShapeTensor(shape_tensor); } else if (list_new_shape_tensor.size() > 0) { - new_shape = get_new_shape_from_shape_tensorlist(list_new_shape_tensor); + new_shape = GetNewDataFromShapeTensorList(list_new_shape_tensor); } } diff --git a/paddle/fluid/operators/uniform_random_op.h b/paddle/fluid/operators/uniform_random_op.h index 8916fc88a67..c7593965897 100644 --- a/paddle/fluid/operators/uniform_random_op.h +++ b/paddle/fluid/operators/uniform_random_op.h @@ -22,7 +22,7 @@ namespace paddle { namespace operators { using Tensor = framework::Tensor; -inline std::vector get_new_data_from_shape_tensor( +inline std::vector GetNewDataFromShapeTensor( const Tensor *new_data_tensor) { auto *new_data = new_data_tensor->data(); if (platform::is_gpu_place(new_data_tensor->place())) { @@ -35,7 +35,7 @@ inline std::vector get_new_data_from_shape_tensor( return vec_new_data; } -inline std::vector get_new_shape_from_shape_tensorlist( +inline std::vector GetNewDataFromShapeTensorList( const std::vector &list_new_shape_tensor) { std::vector vec_new_shape; vec_new_shape.reserve(list_new_shape_tensor.size()); @@ -46,10 +46,9 @@ inline std::vector get_new_shape_from_shape_tensorlist( if (platform::is_gpu_place(tensor->place())) { framework::Tensor temp; TensorCopySync(*tensor, platform::CPUPlace(), &temp); - - vec_new_shape.push_back(static_cast(*temp.data())); + vec_new_shape.push_back(*temp.data()); } else { - vec_new_shape.push_back(static_cast(*tensor->data())); + vec_new_shape.push_back(*tensor->data()); } } -- GitLab