Skip to content

Commit 2e32007

Browse files
committed
fix bugs
1 parent 5b4f283 commit 2e32007

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

paddle/fluid/framework/details/data_balance_op_handle.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ void DataBalanceOpHandle::RunImpl() {
8181
"The NoDummyInputSize and NoDummyOutputSize should be equal.");
8282
int data_num = in_var_handles.size() / places_.size();
8383
WaitInputVarGenerated();
84-
85-
std::vector<std::vector<LoDTensor *>> lod_tensors;
84+
std::vector<std::vector<LoDTensor *>> lod_tensors(data_num);
8685
std::vector<int> device_sizes;
8786
for (int i = 0; i < static_cast<int>(in_var_handles.size()); ++i) {
8887
PADDLE_ENFORCE_EQ(in_var_handles[i]->name_, out_var_handles[i]->name_,
@@ -105,7 +104,6 @@ void DataBalanceOpHandle::RunImpl() {
105104
}
106105
}
107106
const auto &balance_plan = GetBalancePlan(device_sizes);
108-
109107
for (const auto &trans : balance_plan) {
110108
for (int data_idx = 0; data_idx < data_num; ++data_idx) {
111109
LoDTensor *src_tensor = lod_tensors[data_idx][trans[0]];

paddle/fluid/framework/details/data_balance_op_handle.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ struct DataBalanceOpHandle : public OpHandleBase {
4141
std::vector<std::array<int, 3>> GetBalancePlan(
4242
const std::vector<int> &batch_size_per_device);
4343

44-
const std::vector<Scope *> &local_scopes_;
45-
const std::vector<platform::Place> &places_;
44+
const std::vector<Scope *> local_scopes_;
45+
const std::vector<platform::Place> places_;
4646
};
4747

4848
} // namespace details

0 commit comments

Comments
 (0)