xref: /aosp_15_r20/external/tensorflow/tensorflow/compiler/mlir/lite/tf_tfl_translate_cl.h (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1 /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #ifndef TENSORFLOW_COMPILER_MLIR_LITE_TF_TFL_TRANSLATE_CL_H_
17 #define TENSORFLOW_COMPILER_MLIR_LITE_TF_TFL_TRANSLATE_CL_H_
18 
19 // This file contains command-line options aimed to provide the parameters
20 // required by the TensorFlow Graph(Def) to TF Lite Flatbuffer conversion. It is
21 // only intended to be included by binaries.
22 
23 #include <string>
24 
25 #include "llvm/Support/CommandLine.h"
26 
27 // The commandline options are defined in LLVM style, so the caller should
28 // use llvm::InitLLVM to initialize the options.
29 //
30 // Please see the implementation file for documentation of details of these
31 // options.
32 // TODO(jpienaar): Revise the command line option parsing here.
33 extern llvm::cl::opt<std::string> input_file_name;
34 extern llvm::cl::opt<std::string> output_file_name;
35 extern llvm::cl::opt<bool> use_splatted_constant;
36 extern llvm::cl::opt<bool> input_mlir;
37 extern llvm::cl::opt<bool> output_mlir;
38 extern llvm::cl::list<std::string> custom_opdefs;
39 extern llvm::cl::opt<bool> emit_quant_adaptor_ops;
40 extern llvm::cl::opt<std::string> quant_stats_file_name;
41 extern llvm::cl::opt<bool> convert_tf_while_to_tfl_while;
42 extern llvm::cl::opt<std::string> select_user_tf_ops;
43 extern llvm::cl::opt<bool> allow_all_select_tf_ops;
44 extern llvm::cl::opt<bool> unfold_batchmatmul;
45 extern llvm::cl::opt<bool> unfold_large_splat_constant;
46 extern llvm::cl::opt<bool> guarantee_all_funcs_one_use;
47 extern llvm::cl::opt<bool> enable_dynamic_update_slice;
48 extern llvm::cl::opt<bool> preserve_assert_op;
49 
50 // Import saved model.
51 extern llvm::cl::opt<bool> import_saved_model_object_graph;
52 extern llvm::cl::opt<bool> import_saved_model_signature_defs;
53 extern llvm::cl::opt<std::string> saved_model_tags;
54 extern llvm::cl::opt<std::string> saved_model_exported_names;
55 
56 // Import HLO.
57 enum HloImportType { proto, hlotxt, mlir_text };
58 
59 extern llvm::cl::opt<bool> import_hlo;
60 extern llvm::cl::opt<HloImportType> hlo_import_type;
61 extern llvm::cl::opt<bool> enable_hlo_to_tf_conversion;
62 #endif  // TENSORFLOW_COMPILER_MLIR_LITE_TF_TFL_TRANSLATE_CL_H_
63