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

Function TEST

lite/test/test_network_options.cpp:21–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19using namespace lite;
20
21TEST(TestNetWorkOptions, no_var_sanity_check_and_record) {
22 Config config;
23 auto tensor = get_input_data("./input_data.npy");
24 std::string model_path = "./shufflenet.mge";
25 std::string input_name = "data";
26 auto result_mgb = mgb_lar(model_path, config, input_name, tensor);
27
28 config.options.var_sanity_check_first_run = false;
29 config.options.comp_node_seq_record_level = 1;
30
31 std::shared_ptr<Network> network = std::make_shared<Network>(config);
32 network->load_model(model_path);
33 std::shared_ptr<Tensor> input_tensor = network->get_io_tensor(input_name);
34
35 auto src_ptr = tensor->get_memory_ptr();
36 auto src_layout = tensor->get_layout();
37 input_tensor->reset(src_ptr, src_layout);
38 std::shared_ptr<Tensor> output_tensor = network->get_output_tensor(0);
39 auto result_tensor = std::make_shared<Tensor>(
40 LiteDeviceType::LITE_CPU, Layout{{1, 1000}, 2, LiteDataType::LITE_FLOAT});
41
42 void* out_data = result_tensor->get_memory_ptr();
43 output_tensor->reset(out_data, result_tensor->get_layout());
44
45 network->forward();
46 network->wait();
47
48 compare_lite_tensor<float>(output_tensor, result_mgb);
49}
50
51TEST(TestNetWorkOptions, auto_optimize_inference_layout) {
52 Config config;

Callers

nothing calls this directly

Calls 14

get_input_dataFunction · 0.85
mgb_larFunction · 0.85
instFunction · 0.85
load_modelMethod · 0.45
get_io_tensorMethod · 0.45
get_memory_ptrMethod · 0.45
get_layoutMethod · 0.45
resetMethod · 0.45
get_output_tensorMethod · 0.45
forwardMethod · 0.45
waitMethod · 0.45
set_implMethod · 0.45

Tested by

no test coverage detected