MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / do_setup

Method do_setup

examples/graph_shufflenet.cpp:42–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 // Set default layout if needed (Single kernel grouped convolution not yet supported int NHWC)
59 if (!common_opts.data_layout->is_set())
60 {
61 common_params.data_layout = DataLayout::NHWC;
62 }
63
64 // Checks
65 ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type),
66 "QASYMM8 not supported for this graph");
67
68 // Print parameter values
69 std::cout << common_params << std::endl;
70 std::cout << "Model: Shufflenet_1_g4" << std::endl;
71
72 // Create model path
73 std::string model_path = "/cnn_data/shufflenet_model/";
74
75 // Get trainable parameters data path
76 std::string data_path = common_params.data_path;
77
78 // Add model path to data path
79 if (!data_path.empty())
80 {
81 data_path += model_path;
82 }
83
84 // Create input descriptor
85 const auto operation_layout = common_params.data_layout;
86 const TensorShape tensor_shape =
87 permute_shape(TensorShape(224U, 224U, 3U, common_params.batches), DataLayout::NCHW, operation_layout);
88 TensorDescriptor input_descriptor =
89 TensorDescriptor(tensor_shape, common_params.data_type).set_layout(operation_layout);
90
91 // Set weights trained layout
92 const DataLayout weights_layout = DataLayout::NCHW;
93
94 // Create preprocessor
95 std::unique_ptr<IPreprocessor> preprocessor = std::make_unique<TFPreproccessor>(0);
96
97 graph << common_params.target << common_params.fast_math_hint
98 << InputLayer(input_descriptor, get_input_accessor(common_params, std::move(preprocessor),
99 false /* Do not convert to BGR */))

Callers

nothing calls this directly

Calls 15

permute_shapeFunction · 0.85
InputLayerClass · 0.85
get_input_accessorFunction · 0.85
ConvolutionLayerClass · 0.85
get_weights_accessorFunction · 0.85
PadStrideInfoClass · 0.85
ActivationLayerClass · 0.85
PoolingLayerClass · 0.85
FlattenLayerClass · 0.85
FullyConnectedLayerClass · 0.85

Tested by

no test coverage detected