diff --git a/paddle/fluid/operators/math/selected_rows_functor.cc b/paddle/fluid/operators/math/selected_rows_functor.cc index f73c9bb9dc57345c74678813cc5a7656ca29e134..d9a3c668a178d4aea43266677c92e9396d41ff28 100644 --- a/paddle/fluid/operators/math/selected_rows_functor.cc +++ b/paddle/fluid/operators/math/selected_rows_functor.cc @@ -332,7 +332,7 @@ struct MergeAdd { int64_t copied_numel = 0; for (auto* in : inputs) { auto* in_data = in->value().data(); - auto in_numel = in->value().numel(); + auto in_numel = in->rows().size() * input_width; memory::Copy(boost::get(out_place), out_data + copied_numel, boost::get(in_place), in_data,