@@ -48,10 +48,8 @@ ::grpc::Status MLModelServiceServer::Infer(
4848 const auto tensor_type = MLModelService::tensor_info::tensor_views_to_data_type (tensor);
4949 if (tensor_type != input.data_type ) {
5050 std::ostringstream message;
51- using ut = std::underlying_type<MLModelService::tensor_info::data_types>::type;
5251 message << " Tensor input `" << input.name << " ` was the wrong type; expected type "
53- << static_cast <ut>(input.data_type ) << " but got type "
54- << static_cast <ut>(tensor_type);
52+ << input.data_type << " but got type " << tensor_type;
5553 return helper.fail (::grpc::INVALID_ARGUMENT, message.str ().c_str ());
5654 }
5755 inputs.emplace (input.name , std::move (tensor));
@@ -74,11 +72,9 @@ ::grpc::Status MLModelServiceServer::Infer(
7472 MLModelService::tensor_info::tensor_views_to_data_type (tensor);
7573 if (tensor_type != input.data_type ) {
7674 std::ostringstream message;
77- using ut = std::underlying_type<MLModelService::tensor_info::data_types>::type;
7875 message << " Tensor input `" << input.name
79- << " ` was the wrong type; expected type "
80- << static_cast <ut>(input.data_type ) << " but got type "
81- << static_cast <ut>(tensor_type);
76+ << " ` was the wrong type; expected type " << input.data_type
77+ << " but got type " << tensor_type;
8278 return helper.fail (::grpc::INVALID_ARGUMENT, message.str ().c_str ());
8379 }
8480 inputs.emplace (std::move (input.name ), std::move (tensor));
@@ -122,12 +118,8 @@ ::grpc::Status MLModelServiceServer::Metadata(
122118 MLModelService::tensor_info::data_type_to_string (s.data_type );
123119 if (!string_for_data_type) {
124120 std::ostringstream message;
125- message
126- << " Served MLModelService returned an unknown data type with value `"
127- << static_cast <
128- std::underlying_type<MLModelService::tensor_info::data_types>::type>(
129- s.data_type )
130- << " ` in its metadata" ;
121+ message << " Served MLModelService returned an unknown data type with value `"
122+ << s.data_type << " ` in its metadata" ;
131123 return helper.fail (grpc::INTERNAL, message.str ().c_str ());
132124 }
133125 new_entry.set_data_type (string_for_data_type);
0 commit comments