1 /* Copyright 2020 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 // This header file defines common utils used by TFLite transformation 17 // passes to work with op attributes. 18 19 #ifndef TENSORFLOW_COMPILER_MLIR_LITE_UTILS_TFTEXT_UTILS_H_ 20 #define TENSORFLOW_COMPILER_MLIR_LITE_UTILS_TFTEXT_UTILS_H_ 21 22 #include "llvm/ADT/StringRef.h" 23 #include "mlir/IR/Builders.h" // from @llvm-project 24 #include "mlir/IR/BuiltinOps.h" // from @llvm-project 25 #include "mlir/IR/BuiltinTypes.h" // from @llvm-project 26 #include "mlir/IR/Location.h" // from @llvm-project 27 #include "mlir/IR/Value.h" // from @llvm-project 28 #include "mlir/Support/LogicalResult.h" // from @llvm-project 29 #include "tensorflow/compiler/mlir/lite/ir/tfl_ops.h" 30 #include "tensorflow/compiler/mlir/tensorflow/ir/tf_attributes.h" 31 #include "tensorflow/core/framework/op.h" 32 33 namespace mlir { 34 namespace TFL { 35 36 // Fuse TF.Text APIs annotated by tf.function to a TFLite custom op. 37 LogicalResult ConvertTFTextAPI(mlir::FuncOp func, llvm::StringRef api, 38 mlir::TF::FuncAttr attr); 39 40 // Check if TF.Text Tensorflow ops are registered. 41 bool IsTFTextRegistered(const tensorflow::OpRegistry* op_registery); 42 43 } // end namespace TFL 44 } // end namespace mlir 45 46 #endif // TENSORFLOW_COMPILER_MLIR_LITE_UTILS_TFTEXT_UTILS_H_ 47