diff --git a/src/model_config_utils.cc b/src/model_config_utils.cc index 737b1eb6d..9066c7b9c 100644 --- a/src/model_config_utils.cc +++ b/src/model_config_utils.cc @@ -1716,13 +1716,18 @@ Status ValidateNonLinearFormatIO( const inference::ModelInput& io, const std::string& platform, bool is_input) { - if ((platform != kTensorRTPlanPlatform) && io.is_non_linear_format_io()) { + if (!io.is_non_linear_format_io()) { + // Nothing to validate as the tensor is not non-linear format. + return Status::Success; + } + + if (platform != kTensorRTPlanPlatform) { return Status( Status::Code::INVALID_ARG, "Non-linear IO format is only supported for the TensorRT platform"); } - if (io.is_non_linear_format_io() && (io.dims_size() != 3)) { + if (io.dims_size() != 3) { std::string io_type = is_input ? "input" : "output"; return Status( Status::Code::INVALID_ARG,