diff --git a/paddle/fluid/inference/api/api_impl.cc b/paddle/fluid/inference/api/api_impl.cc index 960e8a07f5717b9563f2f75a01f26c4787161f41..49c352dcb81ea37df8480e6cbfef55ba6dddd0be 100644 --- a/paddle/fluid/inference/api/api_impl.cc +++ b/paddle/fluid/inference/api/api_impl.cc @@ -275,7 +275,7 @@ bool NativePaddlePredictor::GetFetch( if (buffer.empty() || buffer.length() < sizeof(float) * data.size()) { buffer.Resize(sizeof(float) * data.size()); } - std::memcpy(buffer.data(), data.data(), buffer.length()); + std::memcpy(buffer.data(), data.data(), sizeof(float) * data.size()); // copy LoD for (const auto &level : fetchs[i].lod()) { outputs->at(i).lod.emplace_back(level);