Skip to content

Commit

Permalink
Enable ignoring square brackets when parsing data_shape
Browse files Browse the repository at this point in the history
Signed-off-by: Skrebkov, Artemy <[email protected]>
  • Loading branch information
ArtemySkrebkov committed Nov 27, 2024
1 parent e85d928 commit 7630524
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/plugins/intel_npu/tools/single-image-test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1550,8 +1550,8 @@ std::pair<TensorMap, ProfVec> runInfer(ov::InferRequest& inferRequest, ov::Compi

TensorMap out;
for (const auto& outputInfo : compiledModel.outputs()) {
const std::string layer_name = outputInfo.get_any_name();
out.insert({layer_name, inferRequest.get_tensor(layer_name)});
const std::string layerName = outputInfo.get_any_name();
out.insert({layerName, inferRequest.get_tensor(layerName)});
}

ProfVec profData{};
Expand Down Expand Up @@ -1788,11 +1788,17 @@ bool testMeanIoU(const TensorMap& outputs, const TensorMap& references, const La
}

static ov::Shape parseDataShape(const std::string& dataShapeStr) {
std::vector<size_t> dataShape;
std::istringstream ss(dataShapeStr);
std::string token;
while (std::getline(ss, token, ',')) {
dataShape.push_back(std::stoul(token));
std::vector<uint64_t> dataShape;
std::stringstream ss(dataShapeStr);

char ch; // To discard non-numeric characters
int64_t dim;
while (ss >> ch) {
if (std::isdigit(ch)) {
ss.putback(ch);
ss >> dim;
dataShape.push_back(dim);
}
}
return ov::Shape(dataShape);
}
Expand Down Expand Up @@ -1887,11 +1893,11 @@ static int runSingleImageTest() {
auto model = core.read_model(FLAGS_network);
nameIOTensors(model);

auto inputs_info = std::const_pointer_cast<ov::Model>(model)->inputs();
InputsInfo info_map;
auto inputsInfo = std::const_pointer_cast<ov::Model>(model)->inputs();
InputsInfo infoMap;

std::cout << "Performing reshape" << std::endl;
reshape(std::move(inputs_info), info_map, model, FLAGS_shape,
reshape(std::move(inputsInfo), infoMap, model, FLAGS_shape,
FLAGS_override_model_batch_size, FLAGS_device);

ov::preprocess::PrePostProcessor ppp(model);
Expand Down

0 comments on commit 7630524

Please sign in to comment.