Skip to content

Commit e24aba2

Browse files
committed
polish details by reviewer comments
1 parent 0c90069 commit e24aba2

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

paddle/fluid/extension/src/op_meta_info.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@ namespace paddle {
2525
////////////////////// Op Meta Info //////////////////////
2626

2727
OpMetaInfo& OpMetaInfo::Inputs(std::vector<std::string>&& inputs) {
28-
inputs_ = inputs;
28+
inputs_ = std::forward<std::vector<std::string>>(inputs);
2929
return *this;
3030
}
3131
OpMetaInfo& OpMetaInfo::Outputs(std::vector<std::string>&& outputs) {
32-
outputs_ = outputs;
32+
outputs_ = std::forward<std::vector<std::string>>(outputs);
3333
return *this;
3434
}
3535
OpMetaInfo& OpMetaInfo::SetKernelFn(KernelFunc&& func) {
36-
kernel_fn_ = func;
36+
kernel_fn_ = std::forward<KernelFunc>(func);
3737
return *this;
3838
}
3939
OpMetaInfo& OpMetaInfo::SetInferShapeFn(InferShapeFunc&& func) {
40-
infer_shape_fn_ = func;
40+
infer_shape_fn_ = std::forward<InferShapeFunc>(func);
4141
return *this;
4242
}
4343
OpMetaInfo& OpMetaInfo::SetInferDtypeFn(InferDtypeFunc&& func) {
44-
infer_dtype_fn_ = func;
44+
infer_dtype_fn_ = std::forward<InferDtypeFunc>(func);
4545
return *this;
4646
}
4747

@@ -62,7 +62,7 @@ OpMetaInfoBuilder::OpMetaInfoBuilder(std::string&& name) {
6262
name_ = std::forward<std::string>(name);
6363
auto& info_vector = OpMetaInfoMap::Instance()[name_];
6464
auto op_meta = OpMetaInfo(name_);
65-
info_vector.emplace_back(op_meta);
65+
info_vector.emplace_back(std::move(op_meta));
6666
info_ptr_ = &(info_vector.back());
6767
}
6868

@@ -97,7 +97,7 @@ OpMetaInfoBuilder& OpMetaInfoBuilder::SetBackwardOp(
9797
const std::string& bwd_op_name) {
9898
auto& info_vector = OpMetaInfoMap::Instance()[name_];
9999
auto op_meta = OpMetaInfo(bwd_op_name);
100-
info_vector.emplace_back(op_meta);
100+
info_vector.emplace_back(std::move(op_meta));
101101
info_ptr_ = &(info_vector.back());
102102
return *this;
103103
}

paddle/fluid/framework/custom_tensor_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
template <typename T>
2222
paddle::Tensor InitCPUTensorForTest() {
23-
std::vector<int> tensor_shape = {5, 5};
23+
std::vector<int> tensor_shape{5, 5};
2424
auto t1 = paddle::Tensor(paddle::PlaceType::kCPU);
2525
t1.reshape(tensor_shape);
2626
auto* p_data_ptr = t1.mutable_data<T>(paddle::PlaceType::kCPU);

0 commit comments

Comments
 (0)