diff options
Diffstat (limited to 'tensorflow/tools/graph_transforms/quantize_weights.cc')
-rw-r--r-- | tensorflow/tools/graph_transforms/quantize_weights.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tensorflow/tools/graph_transforms/quantize_weights.cc b/tensorflow/tools/graph_transforms/quantize_weights.cc index e6f1498224..66d800f0da 100644 --- a/tensorflow/tools/graph_transforms/quantize_weights.cc +++ b/tensorflow/tools/graph_transforms/quantize_weights.cc @@ -70,6 +70,10 @@ Status QuantizeWeights(const GraphDef& input_graph_def, min = std::min(min, value); max = std::max(max, value); } + // Make sure the quantization range includes 0.0f. Not all quantized + // Ops behave properly if 0.0f is not in the range. + min = std::min(min, 0.0f); + max = std::max(0.0f, max); // min_value == max_value is a tricky case. It can occur for general // tensors, and of course for scalars. The quantized ops cannot deal // with this case, so we set max_value to something else. |