Fix the quantization flag for the tfcompile

PiperOrigin-RevId: 305069903
Change-Id: I4a356d560e2f31e554ad19580987b74106c8a520
This commit is contained in:
Feng Liu 2020-04-06 11:01:33 -07:00 committed by TensorFlower Gardener
parent 2557efa9ba
commit 9343f8b298
4 changed files with 6 additions and 5 deletions

View File

@ -116,7 +116,7 @@ Status CompileGraph(GraphDef graph_def, const tf2xla::Config& config,
} else {
return errors::Unknown("Unknown mlir_components ", flags.mlir_components);
}
if (flags.quantize) {
if (flags.experimental_quantize) {
TF_RETURN_IF_ERROR(mlir::xla_hlo::XlaQuantize(config, &computation));
}
if (!flags.out_session_module.empty()) {

View File

@ -77,8 +77,9 @@ void AppendMainFlags(std::vector<Flag>* flag_list, MainFlags* flags) {
"Output session module proto."},
{"mlir_components", &flags->mlir_components,
"The MLIR components to enable. Currently only Bridge is supported."},
{"quantize", &flags->quantize,
"If set, quantization will be applied before HLO code generation."},
{"experimental_quantize", &flags->experimental_quantize,
"If set, quantization passes will run and dump the result before HLO "
"code generation."},
{"gen_name_to_index", &flags->gen_name_to_index,
"Generate name-to-index data for Lookup{Arg,Result}Index methods."},
{"gen_program_shape", &flags->gen_program_shape,

View File

@ -42,7 +42,7 @@ struct MainFlags {
string out_header;
string out_session_module;
string mlir_components;
bool quantize = false;
bool experimental_quantize = false;
// C++ codegen options
bool gen_name_to_index = false;

View File

@ -1,4 +1,4 @@
# RUN: not tfcompile --graph=%s.pbtxt --config=%s.config.pbtxt --quantize --cpp_class="::test::fadd_quant" 2>&1 | FileCheck %s -dump-input-on-failure
# RUN: not tfcompile --graph=%s.pbtxt --config=%s.config.pbtxt --experimental_quantize --cpp_class="::test::fadd_quant" 2>&1 | FileCheck %s -dump-input-on-failure
# TODO(fengliuai): update this file with the progress of the implementation
// CHECK: func @main