diff --git a/paddle/fluid/pir/dialect/operator/ir/ir_tensor.cc b/paddle/fluid/pir/dialect/operator/ir/ir_tensor.cc index 6383257647323..131a8b1848bd4 100644 --- a/paddle/fluid/pir/dialect/operator/ir/ir_tensor.cc +++ b/paddle/fluid/pir/dialect/operator/ir/ir_tensor.cc @@ -43,10 +43,10 @@ IrTensor& IrTensor::operator=(const IrTensor& other) { } IrTensor& IrTensor::operator=(IrTensor&& other) noexcept { - dims_ = std::move(other.dims()); + dims_ = other.dims(); dtype_ = other.dtype(); layout_ = other.layout(); - lod_ = std::move(other.lod()); + lod_ = other.lod(); offset_ = other.offset(); return *this; } diff --git a/paddle/phi/core/dense_tensor.cc b/paddle/phi/core/dense_tensor.cc index 205bd0614bf3e..d15cc4eeafda1 100644 --- a/paddle/phi/core/dense_tensor.cc +++ b/paddle/phi/core/dense_tensor.cc @@ -47,7 +47,7 @@ DenseTensor::DenseTensor(Allocator* a, const DenseTensorMeta& meta) : meta_(meta), holder_(a->Allocate(SizeOf(dtype()) * numel())) {} DenseTensor::DenseTensor(Allocator* a, DenseTensorMeta&& meta) - : meta_(std::move(meta)), holder_(a->Allocate(SizeOf(dtype()) * numel())) {} + : meta_(meta), holder_(a->Allocate(SizeOf(dtype()) * numel())) {} DenseTensor::DenseTensor(const std::shared_ptr& holder, const DenseTensorMeta& meta) diff --git a/paddle/phi/core/distributed/auto_parallel/inferspmd_utils.cc b/paddle/phi/core/distributed/auto_parallel/inferspmd_utils.cc index 56a9d618fec3e..e8d7da026e518 100644 --- a/paddle/phi/core/distributed/auto_parallel/inferspmd_utils.cc +++ b/paddle/phi/core/distributed/auto_parallel/inferspmd_utils.cc @@ -144,7 +144,7 @@ bool SpmdRuleFactory::ContainsSpmdRule(const std::string& kernel_name) const { } int SpmdRuleFactory::InsertSpmdRule(std::string kernel_name, SpmdRule rule) { - spmd_rule_map_.insert({std::move(kernel_name), std::move(rule)}); + spmd_rule_map_.insert({std::move(kernel_name), rule}); return 0; } diff --git a/paddle/phi/core/tensor_meta.cc b/paddle/phi/core/tensor_meta.cc index 31bd287a6aee6..6fa4acc9931d4 100644 --- a/paddle/phi/core/tensor_meta.cc +++ b/paddle/phi/core/tensor_meta.cc @@ -187,7 +187,7 @@ DenseTensorMeta& DenseTensorMeta::operator=( // NOLINT DenseTensorMeta&& other) { is_scalar = other.is_scalar; use_gpudnn = other.use_gpudnn; - dims = std::move(other.dims); + dims = other.dims; dtype = other.dtype; layout = other.layout; lod = std::move(other.lod); @@ -195,7 +195,7 @@ DenseTensorMeta& DenseTensorMeta::operator=( // NOLINT if (other.strides.size() == -1) { strides = calc_strides(dims); } else { - strides = std::move(other.strides); + strides = other.strides; } return *this; } diff --git a/test/cpp/phi/core/test_dense_tensor.cc b/test/cpp/phi/core/test_dense_tensor.cc index 213f7ca3dc91a..a244b155d54cb 100644 --- a/test/cpp/phi/core/test_dense_tensor.cc +++ b/test/cpp/phi/core/test_dense_tensor.cc @@ -55,7 +55,7 @@ TEST(dense_tensor, meta) { CHECK(meta_4.lod == lod); CHECK(meta_4.valid()); - DenseTensorMeta meta_5(std::move(meta_4)); + DenseTensorMeta meta_5(meta_4); CHECK(meta_5.dtype == dtype); CHECK(meta_5.dims == dims); CHECK(meta_5.layout == layout);