diff --git a/paddle/fluid/operators/math/selected_rows_functor.cc b/paddle/fluid/operators/math/selected_rows_functor.cc index a1be92899840aa3359cfd926ec645c825468a48a..f6fe2bc2f674e333c4c65f3301f9eae55cbb0fe9 100644 --- a/paddle/fluid/operators/math/selected_rows_functor.cc +++ b/paddle/fluid/operators/math/selected_rows_functor.cc @@ -300,11 +300,11 @@ struct MergeAdd { auto* out_data = out.mutable_value()->data(); + auto blas = math::GetBlas(context); for (auto* input : inputs) { auto* input_data = input->value().data(); auto& input_rows = input->rows(); - auto blas = math::GetBlas(context); for (size_t i = 0; i < input_rows.size(); i++) { size_t out_i = rows_to_id[input_rows[i]]; elementwise_add(