• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_UTILS_CONVERT_TYPE_H_
17 #define TENSORFLOW_COMPILER_MLIR_LITE_UTILS_CONVERT_TYPE_H_
18 
19 #include "mlir/IR/Types.h"  // TF:llvm-project
20 #include "tensorflow/compiler/xla/statusor.h"
21 #include "tensorflow/core/framework/types.h"
22 #include "tensorflow/lite/schema/schema_generated.h"
23 
24 namespace mlir {
25 
26 class Builder;
27 }
28 
29 namespace tflite {
30 // Convert the scalar type of a TFlite tensor to the corresponding MLIR type.
31 mlir::Type ConvertElementType(tflite::TensorType type, mlir::Builder builder);
32 
33 // Convert the scalar type of a TFLite tensor to the corresponding
34 // Tensorflow type
35 tensorflow::DataType TflTypeToTfType(tflite::TensorType type);
36 
37 // Convert the Tensorflow scalar type to the corresponding TFLite type
38 xla::StatusOr<tflite::TensorType> TfTypeToTflType(tensorflow::DataType type);
39 
40 }  // namespace tflite
41 #endif  // TENSORFLOW_COMPILER_MLIR_LITE_UTILS_CONVERT_TYPE_H_
42