Skip to content

Commit fbb0559

Browse files
committed
Fixes
1 parent d619bb7 commit fbb0559

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

model_api/cpp/adapters/src/openvino_adapter.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,18 @@ void OpenVINOInferenceAdapter::loadModel(const std::shared_ptr<const ov::Model>&
4949
}
5050
}
5151

52-
void OpenVINOInferenceAdapter::infer(const InferenceInput&, InferenceOutput&) {
53-
throw std::runtime_error("Not implemented");
52+
void OpenVINOInferenceAdapter::infer(const InferenceInput& input, InferenceOutput& output) {
53+
auto request = asyncQueue->operator[](asyncQueue->get_idle_request_id());
54+
for (const auto& [name, tensor] : input) {
55+
request.set_tensor(name, tensor);
56+
}
57+
for (const auto& [name, tensor] : output) {
58+
request.set_tensor(name, tensor);
59+
}
60+
request.infer();
61+
for (const auto& name : outputNames) {
62+
output[name] = request.get_tensor(name);
63+
}
5464
}
5565

5666
InferenceOutput OpenVINOInferenceAdapter::infer(const InferenceInput& input) {
@@ -100,7 +110,7 @@ ov::PartialShape OpenVINOInferenceAdapter::getInputShape(const std::string& inpu
100110
return compiledModel.input(inputName).get_partial_shape();
101111
}
102112
ov::PartialShape OpenVINOInferenceAdapter::getOutputShape(const std::string& outputName) const {
103-
return compiledModel.output(outputName).get_shape();
113+
return compiledModel.output(outputName).get_partial_shape();
104114
}
105115

106116
void OpenVINOInferenceAdapter::initInputsOutputs() {

0 commit comments

Comments
 (0)