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_PASSES_H_ 17 #define TENSORFLOW_COMPILER_MLIR_LITE_TF_TFL_PASSES_H_ 18 19 #include "llvm/ADT/Optional.h" 20 #include "mlir/IR/BuiltinOps.h" // from @llvm-project 21 #include "mlir/Pass/PassManager.h" // from @llvm-project 22 #include "tensorflow/compiler/mlir/lite/common/tfl_pass_config.h" 23 #include "tensorflow/core/public/session.h" 24 25 namespace tensorflow { 26 27 // Add the TF to TFLite passes, specified in the pass_config, into a 28 // pass_manager. The session object will be provided when the TF MLIR is 29 // imported from saved model version one and utilized for capturing resource 30 // variables. 31 void AddTFToTFLConversionPasses(const mlir::TFL::PassConfig& pass_config, 32 mlir::OpPassManager* pass_manager, 33 llvm::Optional<tensorflow::Session*> session); 34 35 // Add the Quantization passes, specified in the quant_specs, into a pass 36 // manager. 37 void AddQuantizationPasses(const mlir::TFL::QuantizationSpecs& quant_specs, 38 mlir::OpPassManager* pass_manager); 39 40 } // namespace tensorflow 41 42 #endif // TENSORFLOW_COMPILER_MLIR_LITE_TF_TFL_PASSES_H_ 43