@@ -179,30 +179,41 @@ bool IBaseModule::check_bool_optional_param(const std::string& param_name, const
179179}
180180
181181void IBaseModule::check_params_with_spec (const ModuleSpec& spec) {
182+ auto error_tip = [this ](const std::string& name) {
183+ return " Module[" + ModuleTypeConverter::toString (module_desc->type ) + " (" + module_desc->name + " )" + " ]: '" +
184+ name + " ' " ;
185+ };
186+
182187 // Check Inputs
183188 const auto & inputs = module_desc->inputs ;
184189 for (const auto & input : inputs) {
185190 // Find input.name in spec.inputs()
186- auto it = std::find_if (spec.inputs ().begin (), spec.inputs ().end (),
187- [&input](const auto & input_spec) { return input_spec.name == input.name ; });
188- OPENVINO_ASSERT (it != spec.inputs ().end (), " Module[" + module_desc->name + " ]: input '" + input.name + " ' is not defined in ModuleSpec" );
191+ auto it = std::find_if (spec.inputs ().begin (), spec.inputs ().end (), [&input](const auto & input_spec) {
192+ return input_spec.name == input.name ;
193+ });
194+ OPENVINO_ASSERT (it != spec.inputs ().end (), error_tip (input.name ) + " is not defined in ModuleSpec" );
195+
189196 // Check input.dt_type in it->supported_types
190197 auto & supported_types = it->supported_types ;
191- OPENVINO_ASSERT (std::find (supported_types.begin (), supported_types.end (), input.dt_type ) != supported_types.end (),
192- " Module[" + module_desc->name + " ]: input '" + input.name + " ' has unsupported data type" );
198+ OPENVINO_ASSERT (
199+ std::find (supported_types.begin (), supported_types.end (), input.dt_type ) != supported_types.end (),
200+ error_tip (input.name ) + " has unsupported data type" );
193201 }
194202
195203 // Check Outputs
196204 const auto & outputs = module_desc->outputs ;
197205 for (const auto & output : outputs) {
198206 // Find output.name in spec.outputs()
199- auto it = std::find_if (spec.outputs ().begin (), spec.outputs ().end (),
200- [&output](const auto & output_spec) { return output_spec.name == output.name ; });
201- OPENVINO_ASSERT (it != spec.outputs ().end (), " Module[" + module_desc->name + " ]: output '" + output.name + " ' is not defined in ModuleSpec" );
207+ auto it = std::find_if (spec.outputs ().begin (), spec.outputs ().end (), [&output](const auto & output_spec) {
208+ return output_spec.name == output.name ;
209+ });
210+ OPENVINO_ASSERT (it != spec.outputs ().end (), error_tip (output.name ) + " is not defined in ModuleSpec" );
211+
202212 // Check output.dt_type in it->supported_types
203213 auto & supported_types = it->supported_types ;
204- OPENVINO_ASSERT (std::find (supported_types.begin (), supported_types.end (), output.dt_type ) != supported_types.end (),
205- " Module[" + module_desc->name + " ]: output '" + output.name + " ' has unsupported data type" );
214+ OPENVINO_ASSERT (
215+ std::find (supported_types.begin (), supported_types.end (), output.dt_type ) != supported_types.end (),
216+ error_tip (output.name ) + " has unsupported data type" );
206217 }
207218}
208219
0 commit comments