Skip to content

Commit

Permalink
fix: Fix warnings thrown by noexcept functions
Browse files Browse the repository at this point in the history
Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>
  • Loading branch information
peri044 committed Jul 15, 2021
1 parent 71be725 commit ddc8950
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
21 changes: 15 additions & 6 deletions core/plugins/impl/interpolate_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,23 @@ bool InterpolatePlugin::supportsFormatCombination(
const nvinfer1::PluginTensorDesc* inOut,
int nbInputs,
int nbOutputs) noexcept {
TRTORCH_ASSERT(nbInputs == 1, "Expected a single tensor as input to interpolate plugin");

if (nbInputs != 1) {
LOG_ERROR("Expected a single tensor as input to interpolate plugin");
}
if (mode_ == "adaptive_max_pool2d") {
TRTORCH_ASSERT(nbOutputs == 2, "Expected 2 tensors as output to interpolate plugin");
TRTORCH_ASSERT(0 <= pos && pos <= 2, "There should be exactly 3 connections to the plugin - 1 input, 2 output");
if (nbOutputs != 2) {
LOG_ERROR("Expected 2 tensors as output to interpolate plugin");
}
if (pos < 0 || pos > 2) {
LOG_ERROR("There should be exactly 3 connections to the plugin - 1 input, 2 output");
}
} else {
TRTORCH_ASSERT(nbOutputs == 1, "Expected a single tensor as output to interpolate plugin");
TRTORCH_ASSERT(0 <= pos && pos <= 1, "There should be exactly 2 connections to the plugin - 1 input, 1 output");
if (nbOutputs != 1) {
LOG_ERROR("Expected a single tensor as output to interpolate plugin");
}
if (pos < 0 || pos > 1) {
LOG_ERROR("There should be exactly 2 connections to the plugin - 1 input, 1 output");
}
}

const nvinfer1::PluginTensorDesc& in = inOut[0];
Expand Down
12 changes: 9 additions & 3 deletions core/plugins/impl/normalize_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,15 @@ bool NormalizePlugin::supportsFormatCombination(
const nvinfer1::PluginTensorDesc* inOut,
int nbInputs,
int nbOutputs) noexcept {
TRTORCH_ASSERT(0 <= pos && pos <= 1, "There should be exactly 2 connections to the plugin - 1 input, 1 output");
TRTORCH_ASSERT(nbInputs == 1, "Expected a single tensor as input to normalize plugin");
TRTORCH_ASSERT(nbOutputs == 1, "Expected a single tensor as output to normalize plugin");
if (pos < 0 || pos > 1) {
LOG_ERROR("There should be exactly 2 connections to the plugin - 1 input, 1 output");
}
if (nbInputs != 1) {
LOG_ERROR("Expected a single tensor as input to normalize plugin");
}
if (nbOutputs != 1) {
LOG_ERROR("Expected a single tensor as output to normalize plugin");
}

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

Expand Down

0 comments on commit ddc8950

Please sign in to comment.