Use double for average computation.

PiperOrigin-RevId: 319877528
Change-Id: I6424477ae59e219fa747aa3e93c18d8989c2d126
This commit is contained in:
Bruce Fontaine 2020-07-06 16:20:10 -07:00 committed by TensorFlower Gardener
parent c175b8c296
commit 2ec18221cb
2 changed files with 2 additions and 2 deletions

View File

@ -306,7 +306,7 @@ struct RestoreOp {
const float* t_data = restored_tensor->flat<float>().data();
float min = std::numeric_limits<float>::infinity();
float max = -std::numeric_limits<float>::infinity();
float avg = 0.0;
double avg = 0.0;
for (int i = 0; i < restored_tensor->NumElements(); ++i) {
if (t_data[i] < min) min = t_data[i];
if (t_data[i] > max) max = t_data[i];

View File

@ -140,7 +140,7 @@ class SaveV2 : public OpKernel {
const float* t_data = tensor.flat<float>().data();
float min = std::numeric_limits<float>::infinity();
float max = -std::numeric_limits<float>::infinity();
float avg = 0.0;
double avg = 0.0;
for (int i = 0; i < tensor.NumElements(); ++i) {
if (t_data[i] < min) min = t_data[i];
if (t_data[i] > max) max = t_data[i];