Add a flag for enabling/disabling legalize tf while pass in tf_tfl_translate

PiperOrigin-RevId: 302770363
Change-Id: I7ad5da21972e0f270cd217ba813d38fb5d6b858d
This commit is contained in:
Jaesung Chung 2020-03-24 16:21:39 -07:00 committed by TensorFlower Gardener
parent 673bac75fd
commit 4a12b6f8d1
3 changed files with 5 additions and 3 deletions

View File

@ -195,6 +195,7 @@ int main(int argc, char **argv) {
mlir::TFL::PassConfig pass_config(quant_specs);
pass_config.emit_builtin_tflite_ops = emit_builtin_tflite_ops;
pass_config.lower_tensor_list_ops = lower_tensor_list_ops;
pass_config.legalize_tf_while = convert_tf_while_to_tfl_while;
// Currently we only do shape inference for saved model import.
if (import_saved_model_object_graph || import_saved_model_signature_defs) {

View File

@ -105,7 +105,7 @@ opt<std::string> quant_stats_file_name("quant-stats",
llvm::cl::init(""));
// NOLINTNEXTLINE
opt<bool> legalize_while(
"legalize-tf-while",
opt<bool> convert_tf_while_to_tfl_while(
"convert_tf_while_to_tfl_while",
llvm::cl::desc("Whether to legalize TF While to TFL While."),
llvm::cl::init(false));
llvm::cl::init(true));

View File

@ -38,6 +38,7 @@ extern llvm::cl::opt<bool> output_mlir;
extern llvm::cl::list<std::string> custom_opdefs;
extern llvm::cl::opt<bool> emit_quant_adaptor_ops;
extern llvm::cl::opt<std::string> quant_stats_file_name;
extern llvm::cl::opt<bool> convert_tf_while_to_tfl_while;
// Import saved model.
extern llvm::cl::opt<bool> import_saved_model_object_graph;