| 19 | using namespace lite; |
| 20 | |
| 21 | TEST(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 | |
| 51 | TEST(TestNetWorkOptions, auto_optimize_inference_layout) { |
| 52 | Config config; |
nothing calls this directly
no test coverage detected