[benchamrk_app] error if -b is set but there's no batch info (#10592)

* Added code showing error message if -b is provided, but got no batch info for inputs

* stylefix / batch>1 case
This commit is contained in:
Fedor Zharinov 2022-02-23 01:30:08 +03:00 committed by GitHub
parent 817550fa0a
commit 75cca1e9e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -451,6 +451,7 @@ std::vector<benchmark_app::InputsInfo> get_inputs_info(const std::string& shape_
for (size_t i = 0; i < min_size; ++i) {
benchmark_app::InputsInfo info_map;
bool is_there_at_least_one_batch_dim = false;
for (auto& item : input_info) {
benchmark_app::InputInfo info;
auto name = item.get_any_name();
@ -602,6 +603,7 @@ std::vector<benchmark_app::InputsInfo> get_inputs_info(const std::string& shape_
}
info.dataShape[batch_index] = batch_size;
reshape_required = true;
is_there_at_least_one_batch_dim = true;
}
} else {
slog::warn << "Input '" << item.get_any_name()
@ -612,6 +614,12 @@ std::vector<benchmark_app::InputsInfo> get_inputs_info(const std::string& shape_
info_map[name] = info;
}
if (batch_size > 1 && !is_there_at_least_one_batch_dim) {
throw std::runtime_error("-b option is provided in command line, but there's no inputs with batch(B) "
"dimension in input layout, so batch cannot be set. "
"You may specify layout explicitly using -layout option.");
}
// Update scale and mean
std::map<std::string, std::vector<float>> scale_map = parse_scale_or_mean(scale_string, info_map);
std::map<std::string, std::vector<float>> mean_map = parse_scale_or_mean(mean_string, info_map);