tensorflow/compiler/mlir/lite/tf_tfl_passes.cc
void CreateTFLStandardPipeline(OpPassManager& pm,
                               const StandardPipelineOptions& options) {
  OpPassManager& func_pm = pm.nest<FuncOp>();

  // tf_executor dialect passes - Cleaning up the IR.
  mlir::TF::StandardPipelineOptions standard_pipeline_options;
  mlir::TF::CreateTFStandardPipeline(func_pm, standard_pipeline_options);

  // This is needed for control flow support with TF TensorList.
  pm.addPass(mlir::TFL::CreateLowerStaticTensorListPass());

  // Saved model pass to mark global tensors immutable.
  pm.addPass(mlir::tf_saved_model::CreateOptimizeGlobalTensorsPass());
  // Used to mark non-exported functions in saved model private.
  pm.addPass(mlir::tf_saved_model::
                 CreateMarkFunctionVisibilityUsingSavedModelLinkagePass());
  // Op fusion pass.
  pm.addPass(mlir::TFL::CreatePrepareCompositeFunctionsPass());

  pm.addNestedPass<mlir::FuncOp>(mlir::TFL::CreateLegalizeTFWhilePass());

  pm.addPass(mlir::createInlinerPass());

  // Canonicalize, CSE etc.
  pm.addPass(mlir::TF::CreateDecodeConstantPass());
  pm.addNestedPass<mlir::FuncOp>(mlir::createCanonicalizerPass());
  pm.addNestedPass<mlir::FuncOp>(mlir::createCSEPass());
  // DCE for private symbols.
  pm.addPass(mlir::createSymbolDCEPass());

  // freeze global tensors.
  pm.addPass(mlir::tf_saved_model::CreateFreezeGlobalTensorsPass());

  // TFLite dialect passes.
  pm.addPass(mlir::TFL::CreatePrepareTFPass(true));
  pm.addNestedPass<mlir::FuncOp>(mlir::createCanonicalizerPass());
  pm.addPass(
      mlir::TFL::CreateLegalizeTFPass(/*run_tfl_runtime_verification=*/true));
  pm.addPass(mlir::TFL::CreateOptimizePass());
  pm.addPass(mlir::TFL::CreateOptimizeFunctionalOpsPass());
  pm.addPass(mlir::createSymbolDCEPass());

  // Canonicalize, CSE etc.
  pm.addNestedPass<mlir::FuncOp>(mlir::createCanonicalizerPass());
  pm.addNestedPass<mlir::FuncOp>(mlir::createCSEPass());

  // Pass for stateful operands like LSTM.
  pm.addPass(mlir::TFL::CreateSplitMergedOperandsPass());

  pm.addPass(mlir::TFL::CreateWhileOutlinePass());

  pm.addPass(mlir::TFL::CreateRuntimeVerifyPass());
}
// NOLINTNEXTLINE
// This creates the standard pass pipeline for TF->TFLite. This
// represents a std configuration for TFLite, for use with APIs like
// tensorflow/python/pywrap_mlir.py::experimental_run_pass_pipeline
// This does not yet include quantization passes.
NOLINTNEXTLINE
This creates the standard pass pipeline for TF->TFLite. This
represents a std configuration for TFLite, for use with APIs like
tensorflow/python/pywrap_mlir.py::experimental_run_pass_pipeline
This does not yet include quantization passes.
NOLINTNEXTLINE This creates the standard pass pipeline for TF - > TFLite . This represents a std configuration for TFLite for use with APIs like tensorflow / python / pywrap_mlir . py :: experimental_run_pass_pipeline This does not yet include quantization passes .
void CreateTFLStandardPipeline(OpPassManager& pm,
                               const StandardPipelineOptions& options) {
  OpPassManager& func_pm = pm.nest<FuncOp>();
  mlir::TF::StandardPipelineOptions standard_pipeline_options;
  mlir::TF::CreateTFStandardPipeline(func_pm, standard_pipeline_options);
  pm.addPass(mlir::TFL::CreateLowerStaticTensorListPass());
  pm.addPass(mlir::tf_saved_model::CreateOptimizeGlobalTensorsPass());
  pm.addPass(mlir::tf_saved_model::
                 CreateMarkFunctionVisibilityUsingSavedModelLinkagePass());
  pm.addPass(mlir::TFL::CreatePrepareCompositeFunctionsPass());
  pm.addNestedPass<mlir::FuncOp>(mlir::TFL::CreateLegalizeTFWhilePass());
  pm.addPass(mlir::createInlinerPass());
  pm.addPass(mlir::TF::CreateDecodeConstantPass());
  pm.addNestedPass<mlir::FuncOp>(mlir::createCanonicalizerPass());
  pm.addNestedPass<mlir::FuncOp>(mlir::createCSEPass());
  pm.addPass(mlir::createSymbolDCEPass());
  pm.addPass(mlir::tf_saved_model::CreateFreezeGlobalTensorsPass());
  pm.addPass(mlir::TFL::CreatePrepareTFPass(true));
  pm.addNestedPass<mlir::FuncOp>(mlir::createCanonicalizerPass());
  pm.addPass(
      mlir::TFL::CreateLegalizeTFPass(true));
  pm.addPass(mlir::TFL::CreateOptimizePass());
  pm.addPass(mlir::TFL::CreateOptimizeFunctionalOpsPass());
  pm.addPass(mlir::createSymbolDCEPass());
  pm.addNestedPass<mlir::FuncOp>(mlir::createCanonicalizerPass());
  pm.addNestedPass<mlir::FuncOp>(mlir::createCSEPass());
  pm.addPass(mlir::TFL::CreateSplitMergedOperandsPass());
  pm.addPass(mlir::TFL::CreateWhileOutlinePass());
  pm.addPass(mlir::TFL::CreateRuntimeVerifyPass());
}
void CreateTFLStandardPipeline ( OpPassManager & pm , const StandardPipelineOptions & options ) { OpPassManager & func_pm = pm . nest < FuncOp > ( ) ; mlir :: TF :: StandardPipelineOptions standard_pipeline_options ; mlir :: TF :: CreateTFStandardPipeline ( func_pm , standard_pipeline_options ) ; pm . addPass ( mlir :: TFL :: CreateLowerStaticTensorListPass ( ) ) ; pm . addPass ( mlir :: tf_saved_model :: CreateOptimizeGlobalTensorsPass ( ) ) ; pm . addPass ( mlir :: tf_saved_model :: CreateMarkFunctionVisibilityUsingSavedModelLinkagePass ( ) ) ; pm . addPass ( mlir :: TFL :: CreatePrepareCompositeFunctionsPass ( ) ) ; pm . addNestedPass < mlir :: FuncOp > ( mlir :: TFL :: CreateLegalizeTFWhilePass ( ) ) ; pm . addPass ( mlir :: createInlinerPass ( ) ) ; pm . addPass ( mlir :: TF :: CreateDecodeConstantPass ( ) ) ; pm . addNestedPass < mlir :: FuncOp > ( mlir :: createCanonicalizerPass ( ) ) ; pm . addNestedPass < mlir :: FuncOp > ( mlir :: createCSEPass ( ) ) ; pm . addPass ( mlir :: createSymbolDCEPass ( ) ) ; pm . addPass ( mlir :: tf_saved_model :: CreateFreezeGlobalTensorsPass ( ) ) ; pm . addPass ( mlir :: TFL :: CreatePrepareTFPass ( true ) ) ; pm . addNestedPass < mlir :: FuncOp > ( mlir :: createCanonicalizerPass ( ) ) ; pm . addPass ( mlir :: TFL :: CreateLegalizeTFPass ( true ) ) ; pm . addPass ( mlir :: TFL :: CreateOptimizePass ( ) ) ; pm . addPass ( mlir :: TFL :: CreateOptimizeFunctionalOpsPass ( ) ) ; pm . addPass ( mlir :: createSymbolDCEPass ( ) ) ; pm . addNestedPass < mlir :: FuncOp > ( mlir :: createCanonicalizerPass ( ) ) ; pm . addNestedPass < mlir :: FuncOp > ( mlir :: createCSEPass ( ) ) ; pm . addPass ( mlir :: TFL :: CreateSplitMergedOperandsPass ( ) ) ; pm . addPass ( mlir :: TFL :: CreateWhileOutlinePass ( ) ) ; pm . addPass ( mlir :: TFL :: CreateRuntimeVerifyPass ( ) ) ; }
NOLINTNEXTLINE
This creates the standard pass pipeline for TF->TFLite.
NOLINTNEXTLINE This creates the standard pass pipeline for TF - > TFLite .
// tf_executor dialect passes - Cleaning up the IR. // This is needed for control flow support with TF TensorList. // Saved model pass to mark global tensors immutable. // Used to mark non-exported functions in saved model private. // Op fusion pass. // Canonicalize, CSE etc. // DCE for private symbols. // freeze global tensors. // TFLite dialect passes. /*run_tfl_runtime_verification=*/ // Canonicalize, CSE etc. // Pass for stateful operands like LSTM.