diff options
-rw-r--r-- | examples/graph_alexnet.cpp | 6 | ||||
-rw-r--r-- | examples/graph_inception_v3.cpp | 6 | ||||
-rw-r--r-- | examples/graph_inception_v4.cpp | 6 | ||||
-rw-r--r-- | examples/graph_mobilenet.cpp | 3 | ||||
-rw-r--r-- | examples/graph_squeezenet_v1_1.cpp | 6 | ||||
-rw-r--r-- | utils/CommonGraphOptions.cpp | 15 | ||||
-rw-r--r-- | utils/CommonGraphOptions.h | 2 |
7 files changed, 34 insertions, 10 deletions
diff --git a/examples/graph_alexnet.cpp b/examples/graph_alexnet.cpp index 944a435c3b..8394587c60 100644 --- a/examples/graph_alexnet.cpp +++ b/examples/graph_alexnet.cpp @@ -58,6 +58,12 @@ public: return false; } + // Set default layout if needed + if(!common_opts.data_layout->is_set() && common_params.target == Target::NEON) + { + common_params.data_layout = DataLayout::NCHW; + } + // Checks ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!"); diff --git a/examples/graph_inception_v3.cpp b/examples/graph_inception_v3.cpp index c41b0a808e..3d35117891 100644 --- a/examples/graph_inception_v3.cpp +++ b/examples/graph_inception_v3.cpp @@ -58,6 +58,12 @@ public: return false; } + // Set default layout if needed + if(!common_opts.data_layout->is_set() && common_params.target == Target::NEON) + { + common_params.data_layout = DataLayout::NCHW; + } + // Checks ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!"); diff --git a/examples/graph_inception_v4.cpp b/examples/graph_inception_v4.cpp index b61acfcb3f..1ca8c5fbea 100644 --- a/examples/graph_inception_v4.cpp +++ b/examples/graph_inception_v4.cpp @@ -58,6 +58,12 @@ public: return false; } + // Set default layout if needed + if(!common_opts.data_layout->is_set() && common_params.target == Target::NEON) + { + common_params.data_layout = DataLayout::NCHW; + } + // Checks ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!"); diff --git a/examples/graph_mobilenet.cpp b/examples/graph_mobilenet.cpp index d182844530..a8b0f4789c 100644 --- a/examples/graph_mobilenet.cpp +++ b/examples/graph_mobilenet.cpp @@ -43,9 +43,6 @@ public: GraphMobilenetExample() : cmd_parser(), common_opts(cmd_parser), common_params(), graph(0, "MobileNetV1") { - // Sets default layout to NHWC - common_opts.data_layout->parse("NHWC"); - // Add model id option model_id_opt = cmd_parser.add_option<SimpleOption<int>>("model-id", 0); model_id_opt->set_help("Mobilenet model id (0: 1.0_224, else: 0.75_160"); diff --git a/examples/graph_squeezenet_v1_1.cpp b/examples/graph_squeezenet_v1_1.cpp index 631f123e63..bf6324698f 100644 --- a/examples/graph_squeezenet_v1_1.cpp +++ b/examples/graph_squeezenet_v1_1.cpp @@ -58,6 +58,12 @@ public: return false; } + // Set default layout if needed + if(!common_opts.data_layout->is_set() && common_params.target == Target::NEON) + { + common_params.data_layout = DataLayout::NCHW; + } + // Checks ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!"); diff --git a/utils/CommonGraphOptions.cpp b/utils/CommonGraphOptions.cpp index 2e5d787448..4247b2d3e5 100644 --- a/utils/CommonGraphOptions.cpp +++ b/utils/CommonGraphOptions.cpp @@ -148,7 +148,7 @@ CommonGraphOptions::CommonGraphOptions(CommandLineParser &parser) target = parser.add_option<EnumOption<Target>>("target", supported_targets, Target::NEON); data_type = parser.add_option<EnumOption<DataType>>("type", supported_data_types, DataType::F32); - data_layout = parser.add_option<EnumOption<DataLayout>>("layout", supported_data_layouts, DataLayout::NCHW); + data_layout = parser.add_option<EnumOption<DataLayout>>("layout", supported_data_layouts); help->set_help("Show this help message"); threads->set_help("Number of threads to use"); @@ -172,11 +172,14 @@ CommonGraphParams consume_common_graph_parameters(CommonGraphOptions &options) auto validation_range = parse_validation_range(options.validation_range->value()); CommonGraphParams common_params; - common_params.help = options.help->is_set() ? options.help->value() : false; - common_params.threads = options.threads->value(); - common_params.target = options.target->value(); - common_params.data_type = options.data_type->value(); - common_params.data_layout = options.data_layout->value(); + common_params.help = options.help->is_set() ? options.help->value() : false; + common_params.threads = options.threads->value(); + common_params.target = options.target->value(); + common_params.data_type = options.data_type->value(); + if(options.data_layout->is_set()) + { + common_params.data_layout = options.data_layout->value(); + } common_params.enable_tuner = options.enable_tuner->is_set() ? options.enable_tuner->value() : false; common_params.fast_math_hint = options.fast_math_hint->is_set() ? fast_math_hint_value : FastMathHint::Disabled; common_params.data_path = options.data_path->value(); diff --git a/utils/CommonGraphOptions.h b/utils/CommonGraphOptions.h index 23c3cc7c30..921889d7c7 100644 --- a/utils/CommonGraphOptions.h +++ b/utils/CommonGraphOptions.h @@ -91,7 +91,7 @@ struct CommonGraphParams int threads{ 0 }; arm_compute::graph::Target target{ arm_compute::graph::Target::NEON }; arm_compute::DataType data_type{ DataType::F32 }; - arm_compute::DataLayout data_layout{ DataLayout::NCHW }; + arm_compute::DataLayout data_layout{ DataLayout::NHWC }; bool enable_tuner{ false }; arm_compute::graph::FastMathHint fast_math_hint{ arm_compute::graph::FastMathHint::Disabled }; std::string data_path{}; |