28 MPModelProto*
model) {
29 MPModelProto model_proto;
30 MPModelRequest request_proto;
36 const bool is_model_proto = model_proto.variable_size() > 0;
37 const bool is_request_proto = request_proto.model().variable_size() > 0;
38 if (!is_model_proto && !is_request_proto) {
39 LOG(ERROR) <<
"Failed to parse '" << input_file_path
40 <<
"' as an MPModelProto or an MPModelRequest.";
43 if (is_model_proto && is_request_proto) {
44 LOG(ERROR) << input_file_path
45 <<
" is parsing as both MPModelProto and MPModelRequest";
48 if (is_request_proto) {
49 VLOG(1) <<
"Read input proto as an MPModelRequest.";
50 model_proto.Swap(request_proto.mutable_model());
52 VLOG(1) <<
"Read input proto as an MPModelProto.";
55 model->Swap(&model_proto);