Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【cherry-pick】fix PGLBOX training bug #65179

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions paddle/fluid/framework/device_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ void PrintLodTensorType<float>(phi::DenseTensor* tensor,
char separator,
bool need_leading_separator,
int num_decimals) {
std::string buf;
buf.resize(MAX_FLOAT_BUFF_SIZE);
char buf[MAX_FLOAT_BUFF_SIZE]; // NOLINT
auto count = tensor->numel();
if (start < 0 || end > count) {
VLOG(3) << "access violation";
Expand All @@ -109,7 +108,7 @@ void PrintLodTensorType<float>(phi::DenseTensor* tensor,
out_val += "0";
} else {
std::string format = "%." + std::to_string(num_decimals) + "f";
sprintf(&buf[0], &format[0], tensor->data<float>()[i]); // NOLINT
sprintf(buf, &format[0], tensor->data<float>()[i]); // NOLINT
out_val += buf;
}
}
Expand Down