MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / LITE_set_start_callback

Function LITE_set_start_callback

lite/lite-c/src/network.cpp:423–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

421}
422
423int LITE_set_start_callback(
424 LiteNetwork network, const LiteStartCallback start_callback) {
425 LITE_CAPI_BEGIN();
426 LITE_ASSERT(network, "The network pass to LITE api is null");
427 auto lite_start_callback =
428 [start_callback](const std::unordered_map<
429 std::string,
430 std::pair<lite::IO, std::shared_ptr<lite::Tensor>>>&
431 inputs_map) -> void {
432 std::vector<LiteIO> ios;
433 std::vector<LiteTensor> io_tensors;
434 size_t nr_io = 0;
435 for (const auto& io : inputs_map) {
436 nr_io++;
437 auto&& lite_io = io.second.first;
438 ios.push_back(
439 {lite_io.name.c_str(), lite_io.is_host, lite_io.io_type,
440 convert_to_clayout(lite_io.config_layout)});
441 io_tensors.push_back(io.second.second.get());
442 }
443 start_callback(ios.data(), io_tensors.data(), nr_io);
444 };
445 static_cast<lite::Network*>(network)->set_start_callback(lite_start_callback);
446 LITE_CAPI_END();
447}
448
449int LITE_set_start_callback_with_userdata(
450 LiteNetwork network, const LiteStartCallbackWithData start_callback,

Callers 1

TESTFunction · 0.85

Calls 6

convert_to_clayoutFunction · 0.85
start_callbackFunction · 0.85
push_backMethod · 0.45
getMethod · 0.45
dataMethod · 0.45
set_start_callbackMethod · 0.45

Tested by 1

TESTFunction · 0.68