Run inference with multiple inputs and multiple outputs.
169 {
170
172
173
174
175 std::vector<std::unique_ptr<tc::InferInput>>
inputs;
176 inputs.reserve(inputData.size());
177
178 for (auto& [inputName, inputInfo] : inputData) {
179
180 const std::vector<int64_t>& inputShape = inputInfo.first;
182
184 [&](const auto& dataVec) {
185 using T = std::decay_t<
decltype(dataVec[0])>;
186 return m_impl->prepareInput<
T>(inputName, inputShape, dataVec,
188 },
189 variant));
190 }
191
192
193 std::vector<tc::InferInput*> rawInputs;
194 for (auto& input : inputs) {
195 rawInputs.push_back(
input.get());
196 }
197
198
199 tc::InferenceServerGrpcClient*
client =
nullptr;
201 assert(client != nullptr);
202
203
204 std::shared_ptr<tc::InferResult>
results;
205 tc::Headers http_headers;
206 grpc_compression_algorithm compression_algorithm =
207 grpc_compression_algorithm::GRPC_COMPRESS_NONE;
208
209 if (
m_impl->m_parentAsyncAlg ==
nullptr) {
210 tc::InferResult* rawResultPtr = nullptr;
212 {}, http_headers, compression_algorithm));
213 assert(rawResultPtr != nullptr);
215 } else {
216
217 using Promise_t = boost::fibers::promise<tc::InferResult*>;
218 using Future_t = boost::fibers::future<tc::InferResult*>;
219 Promise_t promise{};
220 Future_t future = promise.get_future();
221 auto callback = [&promise](tc::InferResult* resultPtr) {
222 assert(resultPtr != nullptr);
223 promise.set_value(resultPtr);
224 };
226 {}, http_headers, compression_algorithm));
229 }
230
231
232 for (auto& [outputName, outputInfo] : outputData) {
233
235
237 [&](auto& dataVec) {
238 using T = std::decay_t<
decltype(dataVec[0])>;
240 },
241 variant));
242 }
243
244
245 return StatusCode::SUCCESS;
246}
#define ATH_CHECK
Evaluate an expression and check for errors.
std::variant< std::vector< float >, std::vector< int64_t > > DataVariant