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

Method do_setup

examples/graph_googlenet.cpp:42–174  ·  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 // 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
68 // Create a preprocessor object
69 const std::array<float, 3> mean_rgb{{122.68f, 116.67f, 104.01f}};
70 std::unique_ptr<IPreprocessor> preprocessor = std::make_unique<CaffePreproccessor>(mean_rgb);
71
72 // Create input descriptor
73 const auto operation_layout = common_params.data_layout;
74 const TensorShape tensor_shape =
75 permute_shape(TensorShape(224U, 224U, 3U, common_params.batches), DataLayout::NCHW, operation_layout);
76 TensorDescriptor input_descriptor =
77 TensorDescriptor(tensor_shape, common_params.data_type).set_layout(operation_layout);
78
79 // Set weights trained layout
80 const DataLayout weights_layout = DataLayout::NCHW;
81
82 graph << common_params.target << common_params.fast_math_hint
83 << InputLayer(input_descriptor, get_input_accessor(common_params, std::move(preprocessor)))
84 << ConvolutionLayer(7U, 7U, 64U,
85 get_weights_accessor(data_path, "/cnn_data/googlenet_model/conv1/conv1_7x7_s2_w.npy",
86 weights_layout),
87 get_weights_accessor(data_path, "/cnn_data/googlenet_model/conv1/conv1_7x7_s2_b.npy"),
88 PadStrideInfo(2, 2, 3, 3))
89 .set_name("conv1/7x7_s2")
90 << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))
91 .set_name("conv1/relu_7x7")
92 << PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 3, operation_layout,
93 PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL)))
94 .set_name("pool1/3x3_s2")
95 << NormalizationLayer(NormalizationLayerInfo(NormType::CROSS_MAP, 5, 0.0001f, 0.75f))
96 .set_name("pool1/norm1")
97 << ConvolutionLayer(
98 1U, 1U, 64U,
99 get_weights_accessor(data_path, "/cnn_data/googlenet_model/conv2/conv2_3x3_reduce_w.npy",

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
NormalizationLayerClass · 0.85
FullyConnectedLayerClass · 0.85

Tested by

no test coverage detected