| 47 | GraphMobilenetExample &operator=(const GraphMobilenetExample &) = delete; |
| 48 | ~GraphMobilenetExample() override = default; |
| 49 | bool do_setup(int argc, char **argv) override |
| 50 | { |
| 51 | // Parse arguments |
| 52 | cmd_parser.parse(argc, argv); |
| 53 | cmd_parser.validate(); |
| 54 | |
| 55 | // Consume common parameters |
| 56 | common_params = consume_common_graph_parameters(common_opts); |
| 57 | |
| 58 | // Return when help menu is requested |
| 59 | if (common_params.help) |
| 60 | { |
| 61 | cmd_parser.print_help(argv[0]); |
| 62 | return false; |
| 63 | } |
| 64 | |
| 65 | // Print parameter values |
| 66 | std::cout << common_params << std::endl; |
| 67 | |
| 68 | // Get model parameters |
| 69 | int model_id = model_id_opt->value(); |
| 70 | |
| 71 | // Create input descriptor |
| 72 | unsigned int spatial_size = (model_id == 0 || common_params.data_type == DataType::QASYMM8) ? 224 : 160; |
| 73 | |
| 74 | // Create input descriptor |
| 75 | const TensorShape tensor_shape = |
| 76 | permute_shape(TensorShape(spatial_size, spatial_size, 3U, common_params.batches), DataLayout::NCHW, |
| 77 | common_params.data_layout); |
| 78 | TensorDescriptor input_descriptor = |
| 79 | TensorDescriptor(tensor_shape, common_params.data_type).set_layout(common_params.data_layout); |
| 80 | |
| 81 | // Set graph hints |
| 82 | graph << common_params.target << common_params.fast_math_hint; |
| 83 | |
| 84 | // Create core graph |
| 85 | if (arm_compute::is_data_type_float(common_params.data_type)) |
| 86 | { |
| 87 | create_graph_float(input_descriptor, model_id); |
| 88 | } |
| 89 | else |
| 90 | { |
| 91 | create_graph_qasymm(input_descriptor); |
| 92 | } |
| 93 | |
| 94 | // Create common tail |
| 95 | graph << ReshapeLayer(TensorShape(1001U)).set_name("Reshape") << SoftmaxLayer().set_name("Softmax") |
| 96 | << OutputLayer(get_output_accessor(common_params, 5)); |
| 97 | |
| 98 | // Finalize graph |
| 99 | GraphConfig config; |
| 100 | config.num_threads = common_params.threads; |
| 101 | config.use_tuner = common_params.enable_tuner; |
| 102 | config.tuner_mode = common_params.tuner_mode; |
| 103 | config.tuner_file = common_params.tuner_file; |
| 104 | config.mlgo_file = common_params.mlgo_file; |
| 105 | |
| 106 | graph.finalize(common_params.target, config); |
nothing calls this directly
no test coverage detected