diff options
author | 2018-04-18 12:10:51 -0700 | |
---|---|---|
committer | 2018-04-18 12:14:11 -0700 | |
commit | f0aabfa0139cb83c857e6142286d025515fbf9a1 (patch) | |
tree | b9fb13fda3ec820e545be902e4042c2c5c829793 /tensorflow/contrib/lite/toco/toco_tooling.cc | |
parent | 03d18ae232c3cff4c56d1efec7bf29f9b16c4f68 (diff) |
Make toco generate uint8 weights that are safe for fast int8 kernels.
PiperOrigin-RevId: 193395910
Diffstat (limited to 'tensorflow/contrib/lite/toco/toco_tooling.cc')
-rw-r--r-- | tensorflow/contrib/lite/toco/toco_tooling.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tensorflow/contrib/lite/toco/toco_tooling.cc b/tensorflow/contrib/lite/toco/toco_tooling.cc index 89cb2f85f8..7252ec2ea4 100644 --- a/tensorflow/contrib/lite/toco/toco_tooling.cc +++ b/tensorflow/contrib/lite/toco/toco_tooling.cc @@ -317,12 +317,17 @@ void Transform(const TocoFlags& toco_flags, Model* model) { } CheckIsReadyForQuantization(*model); + auto* ensure_safe_for_int8_kernels = + new EnsureUint8WeightsSafeForFastInt8Kernels; + ensure_safe_for_int8_kernels->set_allow_nudging_weights( + toco_flags.allow_nudging_weights_to_use_fast_gemm_kernel()); RunGraphTransformations(model, "quantization graph transformations", { new RemoveTrivialQuantizedActivationFunc, new RemoveTrivialQuantizedMinMax, new Quantize, new RemoveFinalDequantizeOp, + ensure_safe_for_int8_kernels, }); } else { GraphTransformationsSet dequantization_transformations{new Dequantize}; |