• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TRANSLATE_UTILS_H_
17 #define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TRANSLATE_UTILS_H_
18 
19 #include "mlir/IR/Builders.h"  // from @llvm-project
20 #include "mlir/IR/BuiltinOps.h"  // from @llvm-project
21 #include "mlir/Support/LogicalResult.h"  // from @llvm-project
22 #include "tensorflow/core/framework/versions.pb.h"
23 #include "tensorflow/stream_executor/lib/statusor.h"
24 
25 namespace tensorflow {
26 
27 // Populates the tf.versions attribute on a module, given a corresponding
28 // graph VersionDef proto.
29 void PopulateTfVersions(mlir::ModuleOp module, const VersionDef& versions);
30 
31 // Extracts TensorFlow GraphDef version information from the given module.
32 // Returns failure if version attribute is missing or any of the sub attributes
33 // are invalid.
34 mlir::LogicalResult ExtractTfVersions(mlir::ModuleOp module,
35                                       VersionDef* versions);
36 
37 // Returns TensorFlow GraphDef producer version for the given module. Returns an
38 // error if the version information is missing for the module or is not valid.
39 ::stream_executor::port::StatusOr<int64_t> GetTfGraphProducerVersion(
40     mlir::ModuleOp module);
41 
42 }  // namespace tensorflow
43 
44 #endif  // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TRANSLATE_UTILS_H_
45