254{
255
256
257 if (TRITONSERVER_LogIsEnabled(TRITONSERVER_LOG_VERBOSE)) {
258 common::TritonJson::WriteBuffer
buffer;
259 RETURN_IF_ERROR(ModelConfig().PrettyWrite(&buffer));
260 LOG_MESSAGE(
261 TRITONSERVER_LOG_VERBOSE,
262 (std::string(
"model configuration:\n") +
buffer.Contents()).c_str());
263 }
264
265
266
267
269 RETURN_IF_ERROR(ModelConfig().MemberAsArray("input", &inputs));
270 RETURN_IF_ERROR(ModelConfig().MemberAsArray("output", &outputs));
271
272
273
274 RETURN_ERROR_IF_FALSE(
275 inputs.ArraySize() == 2, TRITONSERVER_ERROR_INVALID_ARG,
276 std::string("model configuration must have 2 inputs"));
277 RETURN_ERROR_IF_FALSE(
279 std::string("model configuration must have ") +
281
282
283
284 common::TritonJson::Value input_cells;
285 RETURN_IF_ERROR(
inputs.IndexAsObject(0, &input_cells));
286
287
288 const char *input_cells_name;
289 size_t input_cells_len;
290 RETURN_IF_ERROR(input_cells.MemberAsString("name", &input_cells_name, &input_cells_len));
291
292
293
294
295
297
298 LOG_MESSAGE(TRITONSERVER_LOG_INFO,
299 (std::string("'traccc' backend: input tensor is '") +
302
303 std::string input_cells_dtype;
304 RETURN_IF_ERROR(input_cells.MemberAsString("data_type", &input_cells_dtype));
306
308
309
310
311 std::set<std::string> configured_outputs;
312 for (
size_t i = 0;
i <
outputs.ArraySize(); ++
i) {
313 common::TritonJson::Value
output;
314 RETURN_IF_ERROR(
outputs.IndexAsObject(i, &output));
315 const char *output_name;
316 size_t output_name_len;
317 RETURN_IF_ERROR(
318 output.MemberAsString(
"name", &output_name, &output_name_len));
319 configured_outputs.emplace(output_name, output_name_len);
320 }
322 RETURN_ERROR_IF_FALSE(
323 configured_outputs.count(expected) == 1, TRITONSERVER_ERROR_INVALID_ARG,
324 std::string("model configuration is missing output '") + expected + "'");
325 }
326
327
328
330 common::TritonJson::Value instance_groups;
331 if (ModelConfig().Find("instance_group", &instance_groups)) {
332 for (
size_t i = 0;
i < instance_groups.ArraySize(); ++
i) {
333 common::TritonJson::Value
group;
334 RETURN_IF_ERROR(instance_groups.IndexAsObject(i, &group));
335
337 if (
group.Find(
"count")) {
338 RETURN_IF_ERROR(
group.MemberAsInt(
"count", &
count));
339 }
340 RETURN_ERROR_IF_FALSE(
341 count >= 0, TRITONSERVER_ERROR_INVALID_ARG,
342 std::string("instance_group count must not be negative"));
343
344 size_t devices = 1;
345 common::TritonJson::Value gpus;
346 if (
group.Find(
"gpus", &gpus) && gpus.ArraySize() > 0) {
347 devices = gpus.ArraySize();
348 }
350 }
351 }
352
353
356 }
357
358 LOG_MESSAGE(TRITONSERVER_LOG_INFO,
359 (std::string("'traccc' backend: model configured with ") +
361 " instance(s), one event slot each").c_str());
362
363 return nullptr;
364}
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
const std::array< std::string, 4 > outputNames