1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
# Description:
# Example for plugin support in TensorRT(http://developer.nvidia.com/tensorrt)
# through TensorFlow integration. Targeting TensorRT 3.0.4
# APIs are meant to change while upgrading TRT.
# add init_py into pip package BUILD dependency to install it.
package(default_visibility = ["//tensorflow:__subpackages__"])
licenses(["notice"]) # Apache 2.0
load(
"//tensorflow:tensorflow.bzl",
"tf_custom_op_library",
"tf_custom_op_library_additional_deps",
"tf_gen_op_libs",
"tf_gen_op_wrapper_py",
"tf_kernel_library",
)
load("//tensorflow:tensorflow.bzl", "cuda_py_test")
load("//tensorflow:tensorflow.bzl", "tf_custom_op_py_library")
load(
"@local_config_tensorrt//:build_defs.bzl",
"if_tensorrt",
)
tf_gen_op_libs(
op_lib_names = ["inc_op"],
)
tf_gen_op_wrapper_py(
name = "inc_op",
deps = [":inc_op_op_lib"],
)
tf_custom_op_library(
name = "_inc_op.so",
srcs = [
"inc_op_kernel.h",
"inc_op_plugin.cc",
"inc_op_plugin.h",
"ops/inc_op.cc",
],
gpu_srcs = [
"inc_op_kernel.h",
"inc_op_kernel.cu.cc",
],
deps = [
"//tensorflow/contrib/tensorrt:trt_plugins",
"//tensorflow/core:framework_lite",
] + if_tensorrt([
"@local_config_tensorrt//:nv_infer",
]),
)
tf_kernel_library(
name = "inc_op_plugin_kernel",
srcs = ["inc_op_plugin.cc"],
hdrs = [
"inc_op_kernel.h",
"inc_op_plugin.h",
],
gpu_srcs = [
"inc_op_kernel.h",
"inc_op_kernel.cu.cc",
],
deps = [
"//tensorflow/contrib/tensorrt:trt_plugins",
"//tensorflow/core:stream_executor_headers_lib",
] + if_tensorrt([
"@local_config_tensorrt//:nv_infer",
]) + tf_custom_op_library_additional_deps(),
)
tf_custom_op_py_library(
name = "inc_op_loader",
srcs = ["inc_op.py"],
dso = [
":_inc_op.so",
],
kernels = [
":inc_op_op_lib",
":inc_op_plugin_kernel",
],
srcs_version = "PY2AND3",
deps = [
"//tensorflow/python:framework_for_generated_wrappers",
"//tensorflow/python:resources",
],
)
py_library(
name = "init_py",
srcs = ["__init__.py"],
srcs_version = "PY2AND3",
deps = [
":inc_op",
":inc_op_loader",
],
)
cuda_py_test(
name = "plugin_test",
size = "small",
srcs = ["plugin_test.py"],
additional_deps = [
":init_py",
"//tensorflow/contrib/util:util_py",
"//tensorflow/contrib/tensorrt:init_py",
"//tensorflow/python:platform",
"//tensorflow/python:client_testlib",
"//tensorflow/python:tf_optimizer",
],
tags = [
"manual",
"noguitar",
"notap",
],
)
|