diff --git a/paddle/fluid/operators/uniform_random_op.cc b/paddle/fluid/operators/uniform_random_op.cc index 619350771a889c339f0e408ce13fb3d0e2abef43..c704a49466577718037db2fb6f4dd644e820a6ab 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 46b0576ecd16755a365b6f323c5fa04d4bf5962d..53c79cf672e7d71ea2e7202f624a0110cc6ce41d 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 8916fc88a67bffe8c6cfdd4b06f996cc37521ad3..c759396589711328ce206f095c98e917ccdc4b40 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()); } }