Skip to content

Commit c6352fe

Browse files
committed
dont do metadata check
1 parent 92e0fb4 commit c6352fe

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

src/viam/sdk/services/private/mlmodel_server.cpp

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,10 @@ ::grpc::Status MLModelServiceServer::Infer(
3636
return helper.fail(::grpc::INVALID_ARGUMENT, "Called with no input tensors");
3737
}
3838

39-
const auto md = mlms->metadata({});
4039
MLModelService::named_tensor_views inputs;
41-
for (const auto& input : md.inputs) {
42-
const auto where = request->input_tensors().tensors().find(input.name);
43-
if (where == request->input_tensors().tensors().end()) {
44-
// Ignore any inputs for which we don't have metadata, since
45-
// we can't validate the type info.
46-
//
47-
// TODO: Should this be an error? For now we just don't decode
48-
// those tensors.
49-
continue;
50-
}
51-
auto tensor = mlmodel::make_sdk_tensor_from_api_tensor(where->second);
52-
const auto tensor_type = MLModelService::tensor_info::tensor_views_to_data_type(tensor);
53-
if (tensor_type != input.data_type) {
54-
std::ostringstream message;
55-
using ut = std::underlying_type<MLModelService::tensor_info::data_types>::type;
56-
message << "Tensor input `" << input.name << "` was the wrong type; expected type "
57-
<< static_cast<ut>(input.data_type) << " but got type "
58-
<< static_cast<ut>(tensor_type);
59-
return helper.fail(::grpc::INVALID_ARGUMENT, message.str().c_str());
60-
}
61-
inputs.emplace(std::move(input.name), std::move(tensor));
40+
for (const auto& [tensor_name, api_tensor] : request->input_tensors().tensors()) {
41+
auto tensor = mlmodel::make_sdk_tensor_from_api_tensor(api_tensor);
42+
inputs.emplace(std::move(tensor_name), std::move(tensor));
6243
}
6344

6445
const auto outputs = mlms->infer(inputs, helper.getExtra());

0 commit comments

Comments
 (0)