MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / main

Function main

serving/processor/tests/flatbuf_test/cpp/benchmark.cc:354–673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352
353
354int main() {
355
356 std::cout << "DIM_0: " << DIM_0
357 << ", DIM_1: " << DIM_1
358 << ", COUNT: " << COUNT << "\n";
359
360#if DEBUG
361 // if print debug log, only tesing once.
362 TESTING_COUNT = 1;
363#endif
364
365 // user input
366 std::string signature_name("default_serving");
367 std::string input_name;
368 TFDataType data_type;
369 std::vector<long> shape;
370 std::vector<TensorType> content;
371 std::vector<std::string> string_content;
372 std::vector<std::string> fetch_names;
373
374 std::vector<std::string> input_names;
375 std::vector<TFDataType> data_types;
376 std::vector<std::vector<long>> shapes;
377 std::vector<char*> contents;
378 std::vector<std::vector<std::string>> string_contents;
379
380#if USE_STRING_TYPE
381 {
382 PrepareUserStringInputs(signature_name, input_name, data_type,
383 shape, string_content, fetch_names);
384 }
385#else
386 {
387 // prepare data (will be used 10 times)
388 PrepareUserInputs(signature_name, input_name, data_type,
389 shape, content, fetch_names);
390 }
391#endif
392
393 for (int i = 0; i < COUNT; ++i) {
394 input_names.push_back(input_name + "_" + std::to_string(i));
395 data_types.push_back(data_type);
396 shapes.push_back(shape);
397#if USE_STRING_TYPE
398 {
399 string_contents.push_back(string_content);
400 }
401#else
402 {
403 contents.push_back((char*)content.data());
404 }
405#endif
406 }
407
408 // ------------------------ FLATBUFFER -----------------------------
409
410 auto flat_start_timer = system_clock::now();
411

Callers

nothing calls this directly

Calls 15

PrepareUserStringInputsFunction · 0.85
PrepareUserInputsFunction · 0.85
to_stringFunction · 0.85
c_strMethod · 0.80
contentMethod · 0.80
typesMethod · 0.80
Proto2TensorFunction · 0.70
nameMethod · 0.65
push_backMethod · 0.45
dataMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected