From 5728dffb523f1c7b6c71422154cf2d9118edca51 Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Tue, 29 Mar 2022 10:35:14 +0800 Subject: [PATCH] fix assign typo (#41005) --- paddle/fluid/operators/assign_value_op.h | 10 +++++----- paddle/fluid/operators/lu_op.h | 2 +- paddle/fluid/operators/set_value_op_npu.cc | 2 +- paddle/phi/kernels/assign_kernel.cc | 12 ++++++------ 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/paddle/fluid/operators/assign_value_op.h b/paddle/fluid/operators/assign_value_op.h index ba3038fc75..53620685f7 100644 --- a/paddle/fluid/operators/assign_value_op.h +++ b/paddle/fluid/operators/assign_value_op.h @@ -27,7 +27,7 @@ namespace operators { using Tensor = framework::Tensor; template -typename std::enable_if::value>::type CopyVecotorToTensor( +typename std::enable_if::value>::type CopyVectorToTensor( const char* value_name, framework::Tensor* out, const framework::ExecutionContext& ctx) { // If attribute value dtype is vector, it will be converted to @@ -48,9 +48,9 @@ typename std::enable_if::value>::type CopyVecotorToTensor( } template -typename std::enable_if::value>::type -CopyVecotorToTensor(const char* value_name, framework::Tensor* out, - const framework::ExecutionContext& ctx) { +typename std::enable_if::value>::type CopyVectorToTensor( + const char* value_name, framework::Tensor* out, + const framework::ExecutionContext& ctx) { auto values = ctx.Attr>(value_name); framework::TensorFromVector(values, ctx.device_context(), out); } @@ -83,7 +83,7 @@ class AssignValueKernel : public framework::OpKernel { dtype)); break; } - CopyVecotorToTensor(value_name, out, ctx); + CopyVectorToTensor(value_name, out, ctx); out->Resize(phi::make_ddim(shape)); } }; diff --git a/paddle/fluid/operators/lu_op.h b/paddle/fluid/operators/lu_op.h index 939558c710..d6170b7000 100644 --- a/paddle/fluid/operators/lu_op.h +++ b/paddle/fluid/operators/lu_op.h @@ -157,7 +157,7 @@ void SetValueCompute(const framework::ExecutionContext& ctx, value_t.mutable_data(value_dims, place); auto value_name = GetValueName(dtype); - CopyVecotorToTensor(value_name.c_str(), &value_t, ctx); + CopyVectorToTensor(value_name.c_str(), &value_t, ctx); value_t.Resize(value_dims); ElementwiseComputeEx, DeviceContext, T>( ctx, &slice_tensor, &value_t, -1, SubFunctor(), &slice_tensor); diff --git a/paddle/fluid/operators/set_value_op_npu.cc b/paddle/fluid/operators/set_value_op_npu.cc index 31ed820ebe..c22e07583d 100644 --- a/paddle/fluid/operators/set_value_op_npu.cc +++ b/paddle/fluid/operators/set_value_op_npu.cc @@ -141,7 +141,7 @@ class SetValueNPUKernel : public framework::OpKernel { value_t.mutable_data(value_dims, ctx.GetPlace()); auto value_name = GetValueName(framework::TransToProtoVarType(in->dtype())); - CopyVecotorToTensor(value_name.c_str(), &value_t, ctx); + CopyVectorToTensor(value_name.c_str(), &value_t, ctx); value_t.Resize(value_dims); } diff --git a/paddle/phi/kernels/assign_kernel.cc b/paddle/phi/kernels/assign_kernel.cc index bd86d33ed3..a330227fcf 100644 --- a/paddle/phi/kernels/assign_kernel.cc +++ b/paddle/phi/kernels/assign_kernel.cc @@ -47,7 +47,7 @@ void AssignArrayKernel(const Context& dev_ctx, } template -typename std::enable_if::value>::type CopyVecotorToTensor( +typename std::enable_if::value>::type CopyVectorToTensor( const Context& dev_ctx, const std::vector& values, DenseTensor* out) { @@ -72,10 +72,10 @@ typename std::enable_if::value>::type CopyVecotorToTensor( } template -typename std::enable_if::value>::type -CopyVecotorToTensor(const Context& dev_ctx, - const std::vector& values, - DenseTensor* out) { +typename std::enable_if::value>::type CopyVectorToTensor( + const Context& dev_ctx, + const std::vector& values, + DenseTensor* out) { std::vector assign_values; assign_values.reserve(values.size()); for (const auto& val : values) { @@ -98,7 +98,7 @@ void AssignValueKernel(const Context& dev_ctx, "argument dtype is %s, kernel dtype is %s.", dtype, template_dtype)); - CopyVecotorToTensor(dev_ctx, values, out); + CopyVectorToTensor(dev_ctx, values, out); out->Resize(phi::make_ddim(shape)); } -- GitLab