diff --git a/src/model_config_utils.cc b/src/model_config_utils.cc index 9066c7b9c..cc31f666c 100644 --- a/src/model_config_utils.cc +++ b/src/model_config_utils.cc @@ -418,6 +418,34 @@ ValidateIOShape( return Status::Success; } +/// Validate that Non-linear format inputs or outputs are specified correctly +/// in a model configuration. +template +Status +ValidateNonLinearFormatIO( + const ModelIO& io, const std::string& platform, bool is_input) +{ + 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.dims_size() != 3) { + std::string io_type = is_input ? "input" : "output"; + return Status( + Status::Code::INVALID_ARG, + "Non-linear IO format " + io_type + " requires 3 dims"); + } + + return Status::Success; +} + } // namespace Status @@ -1712,31 +1740,6 @@ ValidateInstanceGroup( return Status::Success; } -Status -ValidateNonLinearFormatIO( - const inference::ModelInput& io, const std::string& platform, bool is_input) -{ - 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.dims_size() != 3) { - std::string io_type = is_input ? "input" : "output"; - return Status( - Status::Code::INVALID_ARG, - "Non-linear IO format " + io_type + " requires 3 dims"); - } - - return Status::Success; -} - Status ValidateModelInput( const inference::ModelInput& io, int32_t max_batch_size, diff --git a/src/model_config_utils.h b/src/model_config_utils.h index 60d6b6ac0..8bd9af600 100644 --- a/src/model_config_utils.h +++ b/src/model_config_utils.h @@ -172,17 +172,6 @@ Status ValidateInstanceGroup( /// is not valid. Status ValidateModelIOConfig(const inference::ModelConfig& config); -/// Validate that Non-linear format inputs or outputs are specified correctly -/// in a model configuration. -/// \param io The model input. -/// \param platform The platform name -/// \param is_input Specifies whether it is an input or an output. -/// \return The error status. A non-OK status indicates the configuration -/// is not valid. -Status ValidateNonLinearFormatIO( - const inference::ModelInput& io, const std::string& platform, - bool is_input); - /// Validate that input is specified correctly in a model /// configuration. /// \param io The model input.