From a9dab429ae9b1a902beb72cee96ff640aa0a4142 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Fri, 22 Feb 2019 10:29:37 -0800 Subject: [PATCH] Tiny simplification of TensorProto compression code. PiperOrigin-RevId: 235215099 --- tensorflow/core/framework/tensor_util.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tensorflow/core/framework/tensor_util.cc b/tensorflow/core/framework/tensor_util.cc index 65fb72145f2..abbf19d1bfe 100644 --- a/tensorflow/core/framework/tensor_util.cc +++ b/tensorflow/core/framework/tensor_util.cc @@ -263,14 +263,13 @@ bool CompressRepeatedField(float min_compression_ratio, // Already compressed or invalid. return false; } - T prev_value = TypeHelper::GetValue(num_proto_values - 1, *tensor); + const T last_value = TypeHelper::GetValue(num_proto_values - 1, *tensor); int64 last_index = 0; for (int64 i = num_proto_values - 2; i >= 0 && last_index == 0; --i) { const T cur_value = TypeHelper::GetValue(i, *tensor); - if (PackedValuesNotEqual(cur_value, prev_value)) { + if (PackedValuesNotEqual(cur_value, last_value)) { last_index = i + 1; } - prev_value = cur_value; } const int64 num_truncated_proto_values = last_index + 1; const int64 num_bytes_as_field = -- GitLab