Skip to content

Commit ddc8950

Browse files
committed
fix: Fix warnings thrown by noexcept functions
Signed-off-by: Dheeraj Peri <[email protected]>
1 parent 71be725 commit ddc8950

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

core/plugins/impl/interpolate_plugin.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,23 @@ bool InterpolatePlugin::supportsFormatCombination(
206206
const nvinfer1::PluginTensorDesc* inOut,
207207
int nbInputs,
208208
int nbOutputs) noexcept {
209-
TRTORCH_ASSERT(nbInputs == 1, "Expected a single tensor as input to interpolate plugin");
210-
209+
if (nbInputs != 1) {
210+
LOG_ERROR("Expected a single tensor as input to interpolate plugin");
211+
}
211212
if (mode_ == "adaptive_max_pool2d") {
212-
TRTORCH_ASSERT(nbOutputs == 2, "Expected 2 tensors as output to interpolate plugin");
213-
TRTORCH_ASSERT(0 <= pos && pos <= 2, "There should be exactly 3 connections to the plugin - 1 input, 2 output");
213+
if (nbOutputs != 2) {
214+
LOG_ERROR("Expected 2 tensors as output to interpolate plugin");
215+
}
216+
if (pos < 0 || pos > 2) {
217+
LOG_ERROR("There should be exactly 3 connections to the plugin - 1 input, 2 output");
218+
}
214219
} else {
215-
TRTORCH_ASSERT(nbOutputs == 1, "Expected a single tensor as output to interpolate plugin");
216-
TRTORCH_ASSERT(0 <= pos && pos <= 1, "There should be exactly 2 connections to the plugin - 1 input, 1 output");
220+
if (nbOutputs != 1) {
221+
LOG_ERROR("Expected a single tensor as output to interpolate plugin");
222+
}
223+
if (pos < 0 || pos > 1) {
224+
LOG_ERROR("There should be exactly 2 connections to the plugin - 1 input, 1 output");
225+
}
217226
}
218227

219228
const nvinfer1::PluginTensorDesc& in = inOut[0];

core/plugins/impl/normalize_plugin.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,15 @@ bool NormalizePlugin::supportsFormatCombination(
133133
const nvinfer1::PluginTensorDesc* inOut,
134134
int nbInputs,
135135
int nbOutputs) noexcept {
136-
TRTORCH_ASSERT(0 <= pos && pos <= 1, "There should be exactly 2 connections to the plugin - 1 input, 1 output");
137-
TRTORCH_ASSERT(nbInputs == 1, "Expected a single tensor as input to normalize plugin");
138-
TRTORCH_ASSERT(nbOutputs == 1, "Expected a single tensor as output to normalize plugin");
136+
if (pos < 0 || pos > 1) {
137+
LOG_ERROR("There should be exactly 2 connections to the plugin - 1 input, 1 output");
138+
}
139+
if (nbInputs != 1) {
140+
LOG_ERROR("Expected a single tensor as input to normalize plugin");
141+
}
142+
if (nbOutputs != 1) {
143+
LOG_ERROR("Expected a single tensor as output to normalize plugin");
144+
}
139145

140146
const nvinfer1::PluginTensorDesc& in = inOut[0];
141147

0 commit comments

Comments
 (0)