| 40 | { |
| 41 | } |
| 42 | bool do_setup(int argc, char **argv) override |
| 43 | { |
| 44 | // Parse arguments |
| 45 | cmd_parser.parse(argc, argv); |
| 46 | cmd_parser.validate(); |
| 47 | |
| 48 | // Consume common parameters |
| 49 | common_params = consume_common_graph_parameters(common_opts); |
| 50 | |
| 51 | // Return when help menu is requested |
| 52 | if (common_params.help) |
| 53 | { |
| 54 | cmd_parser.print_help(argv[0]); |
| 55 | return false; |
| 56 | } |
| 57 | |
| 58 | // Checks |
| 59 | ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), |
| 60 | "QASYMM8 not supported for this graph"); |
| 61 | |
| 62 | // Print parameter values |
| 63 | std::cout << common_params << std::endl; |
| 64 | |
| 65 | // Get trainable parameters data path |
| 66 | std::string data_path = common_params.data_path; |
| 67 | unsigned int batches = 4; /** Number of batches */ |
| 68 | |
| 69 | // Create input descriptor |
| 70 | const auto operation_layout = common_params.data_layout; |
| 71 | const TensorShape tensor_shape = |
| 72 | permute_shape(TensorShape(28U, 28U, 1U, batches), DataLayout::NCHW, operation_layout); |
| 73 | TensorDescriptor input_descriptor = |
| 74 | TensorDescriptor(tensor_shape, common_params.data_type).set_layout(operation_layout); |
| 75 | |
| 76 | // Set weights trained layout |
| 77 | const DataLayout weights_layout = DataLayout::NCHW; |
| 78 | |
| 79 | //conv1 << pool1 << conv2 << pool2 << fc1 << act1 << fc2 << smx |
| 80 | graph << common_params.target << common_params.fast_math_hint |
| 81 | << InputLayer(input_descriptor, get_input_accessor(common_params)) |
| 82 | << ConvolutionLayer( |
| 83 | 5U, 5U, 20U, get_weights_accessor(data_path, "/cnn_data/lenet_model/conv1_w.npy", weights_layout), |
| 84 | get_weights_accessor(data_path, "/cnn_data/lenet_model/conv1_b.npy"), PadStrideInfo(1, 1, 0, 0)) |
| 85 | .set_name("conv1") |
| 86 | << PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 2, operation_layout, PadStrideInfo(2, 2, 0, 0))) |
| 87 | .set_name("pool1") |
| 88 | << ConvolutionLayer( |
| 89 | 5U, 5U, 50U, get_weights_accessor(data_path, "/cnn_data/lenet_model/conv2_w.npy", weights_layout), |
| 90 | get_weights_accessor(data_path, "/cnn_data/lenet_model/conv2_b.npy"), PadStrideInfo(1, 1, 0, 0)) |
| 91 | .set_name("conv2") |
| 92 | << PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 2, operation_layout, PadStrideInfo(2, 2, 0, 0))) |
| 93 | .set_name("pool2") |
| 94 | << FullyConnectedLayer(500U, |
| 95 | get_weights_accessor(data_path, "/cnn_data/lenet_model/ip1_w.npy", weights_layout), |
| 96 | get_weights_accessor(data_path, "/cnn_data/lenet_model/ip1_b.npy")) |
| 97 | .set_name("ip1") |
| 98 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name("relu") |
| 99 | << FullyConnectedLayer(10U, |
nothing calls this directly
no test coverage detected