24.02.1
|
Go to the documentation of this file.
31 #include "utils/Utils.h"
39 class GraphAlexnetExample :
public Example
42 GraphAlexnetExample() : cmd_parser(), common_opts(cmd_parser), common_params(), graph(0,
"AlexNet")
45 bool do_setup(
int argc,
char **argv)
override
48 cmd_parser.parse(argc, argv);
49 cmd_parser.validate();
55 if (common_params.help)
57 cmd_parser.print_help(argv[0]);
63 "QASYMM8 not supported for this graph");
66 std::cout << common_params << std::endl;
69 std::string data_path = common_params.data_path;
72 const std::array<float, 3> mean_rgb{{122.68f, 116.67f, 104.01f}};
73 std::unique_ptr<IPreprocessor> preprocessor = std::make_unique<CaffePreproccessor>(mean_rgb);
76 const auto operation_layout = common_params.data_layout;
86 << common_params.target << common_params.fast_math_hint
100 5U, 5U, 256U,
get_weights_accessor(data_path,
"/cnn_data/alexnet_model/conv2_w.npy", weights_layout),
109 3U, 3U, 384U,
get_weights_accessor(data_path,
"/cnn_data/alexnet_model/conv3_w.npy", weights_layout),
115 3U, 3U, 384U,
get_weights_accessor(data_path,
"/cnn_data/alexnet_model/conv4_w.npy", weights_layout),
121 3U, 3U, 256U,
get_weights_accessor(data_path,
"/cnn_data/alexnet_model/conv5_w.npy", weights_layout),
151 config.
use_tuner = common_params.enable_tuner;
154 config.
mlgo_file = common_params.mlgo_file;
158 if (common_params.enable_cl_cache)
160 #ifdef ARM_COMPUTE_CL
165 graph.finalize(common_params.target, config);
168 if (common_opts.enable_cl_cache)
170 #ifdef ARM_COMPUTE_CL
177 void do_run()
override
206 int main(
int argc,
char **argv)
208 return arm_compute::utils::run_example<GraphAlexnetExample>(argc, argv);
@ NCHW
Num samples, channels, height, width.
bool use_tuner
Use a tuner in tunable backends.
int main(int argc, char **argv)
Main program for AlexNet.
std::unique_ptr< graph::ITensorAccessor > get_weights_accessor(const std::string &path, const std::string &data_file, DataLayout file_layout=DataLayout::NCHW)
Generates appropriate weights accessor according to the specified path.
int num_threads
Number of threads to use (thread capable backends), if 0 the backend will auto-initialize,...
std::unique_ptr< graph::ITensorAccessor > get_input_accessor(const arm_compute::utils::CommonGraphParams &graph_parameters, std::unique_ptr< IPreprocessor > preprocessor=nullptr, bool bgr=true)
Generates appropriate input accessor according to the specified graph parameters.
std::string mlgo_file
Filename to load MLGO heuristics from.
DataLayout
[DataLayout enum definition]
void restore_program_cache_from_file(const std::string &filename="cache.bin")
This function loads prebuilt opencl kernels from a file.
CLTunerMode tuner_mode
Tuner mode to be used by the CL tuner.
Activation Layer Information class.
Graph configuration structure.
Class to parse command line arguments.
Common command line options used to configure the graph examples.
TensorShape permute_shape(TensorShape tensor_shape, DataLayout in_data_layout, DataLayout out_data_layout)
Permutes a given tensor shape given the input and output data layout.
Pooling Layer Information struct.
ILayer & set_name(std::string name)
Sets the name of the layer.
void consume_common_graph_parameters(CommonGraphValidateOptions &options, CommonParams &common_params)
Consumes the consume_common_graph_parameters graph options and creates a structure containing any inf...
#define ARM_COMPUTE_EXIT_ON_MSG(cond, msg)
If the condition is true, the given message is printed and program exits.
void save_program_cache_to_file(const std::string &filename="cache.bin")
This function saves opencl kernels library to a file.
Normalization Layer Information class.
std::unique_ptr< graph::ITensorAccessor > get_output_accessor(const arm_compute::utils::CommonGraphParams &graph_parameters, size_t top_n=5, bool is_validation=false, std::ostream &output_stream=std::cout)
Generates appropriate output accessor according to the specified graph parameters.
Copyright (c) 2017-2024 Arm Limited.
TensorDescriptor & set_layout(DataLayout data_layout)
Sets tensor descriptor data layout.
Stream frontend class to construct simple graphs in a stream fashion.
@ CROSS_MAP
Normalization applied cross maps.
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
Structure holding all the common graph parameters.
Includes all the Graph headers at once.
std::string tuner_file
File to load/store tuning values from.