Skip to content

Commit 048cdfb

Browse files
committed
Update builtin_op_importers.cpp
Pytorch exports linear interpolation with align_corners=True with coordinate_transformation_mode = "align_corners" and not "asymmetric". See https://github.com/pytorch/pytorch/blob/master/torch/onnx/symbolic_opset11.py line 214-215: coordinate_transformation_mode = "asymmetric" if interpolate_mode == "nearest" \ else "align_corners" if align_corners else "pytorch_half_pixel" Signed-off-by: QMassoz <[email protected]>
1 parent 8b5328f commit 048cdfb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin_op_importers.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2615,7 +2615,7 @@ DEFINE_BUILTIN_OP_IMPORTER(Resize)
26152615
// alignCorners = 1: ASYMMETRIC
26162616
// Linear:
26172617
// alignCorners = 0: HALF_PIXEL
2618-
// alignCorners = 1: ASYMMETRIC
2618+
// alignCorners = 1: ALIGN_CORNERS
26192619
else
26202620
{
26212621
if (mode == "nearest")
@@ -2624,8 +2624,8 @@ DEFINE_BUILTIN_OP_IMPORTER(Resize)
26242624
}
26252625
else if (mode == "linear")
26262626
{
2627-
ASSERT((transformationMode == "asymmetric" || transformationMode == "pytorch_half_pixel" || transformationMode == "half_pixel") && "TensorRT only supports half pixel, pytorch half_pixel, and asymmetric tranformation mode for linear resizes when scales are provided!", ErrorCode::kUNSUPPORTED_NODE);
2628-
if (transformationMode == "asymmetric")
2627+
ASSERT((transformationMode == "align_corners" || transformationMode == "pytorch_half_pixel" || transformationMode == "half_pixel") && "TensorRT only supports half pixel, pytorch half_pixel, and asymmetric tranformation mode for linear resizes when scales are provided!", ErrorCode::kUNSUPPORTED_NODE);
2628+
if (transformationMode == "align_corners")
26292629
{
26302630
layer->setAlignCorners(true);
26312631
}

0 commit comments

Comments
 (0)