[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:
parent
817550fa0a
commit
75cca1e9e9
@ -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) {
|
for (size_t i = 0; i < min_size; ++i) {
|
||||||
benchmark_app::InputsInfo info_map;
|
benchmark_app::InputsInfo info_map;
|
||||||
|
|
||||||
|
bool is_there_at_least_one_batch_dim = false;
|
||||||
for (auto& item : input_info) {
|
for (auto& item : input_info) {
|
||||||
benchmark_app::InputInfo info;
|
benchmark_app::InputInfo info;
|
||||||
auto name = item.get_any_name();
|
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;
|
info.dataShape[batch_index] = batch_size;
|
||||||
reshape_required = true;
|
reshape_required = true;
|
||||||
|
is_there_at_least_one_batch_dim = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
slog::warn << "Input '" << item.get_any_name()
|
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;
|
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
|
// 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>> 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);
|
std::map<std::string, std::vector<float>> mean_map = parse_scale_or_mean(mean_string, info_map);
|
||||||
|
Loading…
Reference in New Issue
Block a user