Skip to content

Commit 7ef484c

Browse files
Merge pull request #1236 from onnx/tom/opset13Resize
Fixed resize op for opset 13
2 parents e483994 + 5128036 commit 7ef484c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tf2onnx/onnx_opset/nn.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -997,15 +997,17 @@ def version_11(cls, ctx, node, **kwargs):
997997
concat_shape.output[0]
998998
]
999999
transformation_mode = "asymmetric"
1000+
nearest_mode = "floor"
10001001
if "align_corners" in node.attr and node.attr["align_corners"].i:
10011002
transformation_mode = "align_corners"
10021003
if "half_pixel_centers" in node.attr and node.attr["half_pixel_centers"].i:
10031004
if node.type == "ResizeNearestNeighbor":
1004-
transformation_mode = "tf_half_pixel_for_nn"
1005+
transformation_mode = "half_pixel"
1006+
nearest_mode = "round_prefer_ceil"
10051007
else:
10061008
transformation_mode = "half_pixel"
10071009
resize = ctx.make_node("Resize", resize_inputs,
1008-
attr={"mode": mode, "nearest_mode": "floor",
1010+
attr={"mode": mode, "nearest_mode": nearest_mode,
10091011
"coordinate_transformation_mode": transformation_mode})
10101012
shapes = node.output_shapes
10111013
dtypes = node.output_dtypes

0 commit comments

Comments
 (0)