You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
&& "This version of TensorRT only supports floor nearest_mode!",
2564
2566
ErrorCode::kUNSUPPORTED_NODE);
2565
2567
2566
-
// Note both asymmetric and align_corners resize modes go through the same import path in TRT:
2567
-
if (transformationMode == "asymmetric" || transformationMode == "align_corners")
2568
-
{
2569
-
layer->setAlignCorners(true);
2570
-
}
2571
-
2572
2568
// The existence of a fourth input means a shape was passed as the resize parameter
2569
+
// For ONNX resize with the "sizes", TensorRT's resize maps to ONNX's in the following ways:
2570
+
// Nearest:
2571
+
// alignCorners = 0: ASYMMETRIC
2572
+
// alignCorners = 1: ALIGN_CORNERS
2573
+
// Linear:
2574
+
// alignCorners = 0: HALF_PIXEL
2575
+
// alignCorners = 1: ALIGN_CORNERS
2573
2576
if (inputs.size() == 4)
2574
2577
{
2578
+
if (transformationMode == "align_corners")
2579
+
{
2580
+
layer->setAlignCorners(true);
2581
+
}
2582
+
if (mode == "nearest")
2583
+
{
2584
+
ASSERT((transformationMode == "asymmetric" || transformationMode == "align_corners") && "TensorRT only supports asymmetric and align_corners transformation modes for nearest neighbor resizes when sizes are provided!", ErrorCode::kUNSUPPORTED_NODE);
2585
+
}
2586
+
elseif (mode == "linear")
2587
+
{
2588
+
ASSERT((transformationMode == "half_pixel" || transformationMode == "pytorch_half_pixel" || transformationMode == "align_corners") && "TensorRT only supports half_pixel, pytorch_half_pixel, and align_corners transofmration modes for linear resizes when sizes are provided!", ErrorCode::kUNSUPPORTED_NODE);
// For ONNX resize with "scales", TensorRT's resize maps to ONNX's in the following ways:
2596
+
// Nearest:
2597
+
// alignCorners = 0: ASYMMETRIC
2598
+
// alignCorners = 1: ASYMMETRIC
2599
+
// Linear:
2600
+
// alignCorners = 0: HALF_PIXEL
2601
+
// alignCorners = 1: ASYMMETRIC
2602
+
else
2603
+
{
2604
+
if (mode == "nearest")
2605
+
{
2606
+
ASSERT(transformationMode == "asymmetric" && "TensorRT only supports asymmetric tranformation mode for nearest neighbor resizes when scales are provided!",ErrorCode::kUNSUPPORTED_NODE);
2607
+
}
2608
+
elseif (mode == "linear")
2609
+
{
2610
+
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);
2611
+
if (transformationMode == "asymmetric")
2612
+
{
2613
+
layer->setAlignCorners(true);
2614
+
}
2615
+
}
2616
+
}
2580
2617
}
2581
-
// For opset 10 resize, the only supported mode is asymmetric resize, which is mapped to TRT's alignCorners.
2618
+
// For opset 10 resize, the only supported mode is asymmetric resize with scales.
0 commit comments