Skip to content

Commit acd34b1

Browse files
Added TensorRT as a target and fixed Reshape op conversion for TensorRT (#1388)
Signed-off-by: Tom Wildenhain <[email protected]> Co-authored-by: Guenther Schmuelling <[email protected]>
1 parent f190ea9 commit acd34b1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

tf2onnx/constants.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
TARGET_RS5 = "rs5"
2929
TARGET_RS6 = "rs6"
3030
TARGET_CAFFE2 = "caffe2"
31-
POSSIBLE_TARGETS = [TARGET_RS4, TARGET_RS5, TARGET_RS6, TARGET_CAFFE2]
31+
TARGET_TENSORRT = "tensorrt"
32+
POSSIBLE_TARGETS = [TARGET_RS4, TARGET_RS5, TARGET_RS6, TARGET_CAFFE2, TARGET_TENSORRT]
3233
DEFAULT_TARGET = []
3334

3435
NCHW_TO_NHWC = [0, 2, 3, 1]

tf2onnx/onnx_opset/nn.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,8 @@ def version_11(cls, ctx, node, **kwargs):
10621062
if "align_corners" in node.attr and node.attr["align_corners"].i:
10631063
transformation_mode = "align_corners"
10641064
if "half_pixel_centers" in node.attr and node.attr["half_pixel_centers"].i:
1065-
if node.type == "ResizeNearestNeighbor":
1065+
if node.type == "ResizeNearestNeighbor" and not ctx.is_target(constants.TARGET_TENSORRT):
1066+
# TensorRT only supports nearest_mode = "floor" for mode = "nearest"
10661067
transformation_mode = "half_pixel"
10671068
nearest_mode = "round_prefer_ceil"
10681069
else:

0 commit comments

Comments
 (0)