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_TF2TENSORRT_COMMON_UTILS_H_
17 #define TENSORFLOW_COMPILER_TF2TENSORRT_COMMON_UTILS_H_
18 
19 #include <tuple>
20 
21 namespace tensorflow {
22 namespace tensorrt {
23 // Returns the compile time TensorRT library version information
24 // {Maj, Min, Patch}.
25 std::tuple<int, int, int> GetLinkedTensorRTVersion();
26 
27 // Returns the runtime time TensorRT library version information
28 // {Maj, Min, Patch}.
29 std::tuple<int, int, int> GetLoadedTensorRTVersion();
30 }  // namespace tensorrt
31 }  // namespace tensorflow
32 
33 #if GOOGLE_CUDA && GOOGLE_TENSORRT
34 
35 #include "tensorflow/core/platform/logging.h"
36 #include "third_party/tensorrt/NvInfer.h"
37 
38 namespace tensorflow {
39 namespace tensorrt {
40 
41 #define LOG_WARNING_WITH_PREFIX LOG(WARNING) << "TF-TRT Warning: "
42 
43 // Initializes the TensorRT plugin registry if this hasn't been done yet.
44 void MaybeInitializeTrtPlugins(nvinfer1::ILogger* trt_logger);
45 
46 }  // namespace tensorrt
47 }  // namespace tensorflow
48 
49 #endif  // GOOGLE_CUDA && GOOGLE_TENSORRT
50 
51 #endif  // TENSORFLOW_COMPILER_TF2TENSORRT_COMMON_UTILS_H_
52