Browse Source

!3679 fix bug for the decimal place of float16

Merge pull request !3679 from huangbingjian/report_float16
tags/v0.7.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
21810a2e69
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      mindspore/core/ir/tensor.cc

+ 7
- 2
mindspore/core/ir/tensor.cc View File

@@ -233,8 +233,13 @@ class TensorDataImpl : public TensorData {
if (isScalar) {
ss << value;
} else {
ss << std::setw(15) << std::setprecision(8) << std::setiosflags(std::ios::scientific | std::ios::right)
<< value;
if (std::is_same<T, float16>::value) {
ss << std::setw(11) << std::setprecision(4) << std::setiosflags(std::ios::scientific | std::ios::right)
<< value;
} else {
ss << std::setw(15) << std::setprecision(8) << std::setiosflags(std::ios::scientific | std::ios::right)
<< value;
}
}
linefeedThreshold = kThreshold1DFloat;
} else if (type == kNumberTypeBool) {


Loading…
Cancel
Save