Skip to content

Commit

Permalink
fix pglbox ce bug; test=develop (#65179)
Browse files Browse the repository at this point in the history
  • Loading branch information
danleifeng authored Jun 15, 2024
1 parent c00f1de commit c43679f
Showing 1 changed file with 2 additions and 3 deletions.
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

0 comments on commit c43679f

Please sign in to comment.