Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 7 additions & 17 deletions src/plugins/intel_npu/tools/single-image-test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,14 +830,14 @@ bool hasLoadableExt(const std::string& network_path) {
});
}

std::string cleanName(std::string&& name) {
std::string cleanName(std::string name) {
std::replace_if(
name.begin(), name.end(),
[](unsigned char c) {
return !std::isalnum(c);
},
'_');
return std::move(name);
return name;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: I expect both places that deal with copies to be properly optimized via the copy elision in C++17; definitely there's no need to std::move() at return.


ov::Tensor loadImages(const ov::element::Type& precision, const ov::Shape& shape, const ov::Layout& layout,
Expand Down Expand Up @@ -2972,21 +2972,11 @@ static int runSingleImageTest() {

std::string netFileName;
{
auto startPos = FLAGS_network.rfind('/');
if (startPos == std::string::npos) {
startPos = FLAGS_network.rfind('\\');
if (startPos == std::string::npos) {
startPos = 0;
}
}

auto endPos = FLAGS_network.rfind('.');
if (endPos == std::string::npos) {
endPos = FLAGS_network.size();
}

OPENVINO_ASSERT(endPos > startPos);
netFileName = cleanName(FLAGS_network.substr(startPos, endPos - startPos));
std::filesystem::path networkPath(FLAGS_network);
OPENVINO_ASSERT(std::filesystem::exists(networkPath) && networkPath.has_filename(),
"Network path does not exist or is invalid: ",
FLAGS_network);
netFileName = cleanName(networkPath.stem().string());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am also a bit skeptical there's actually a need to use cleanName() at all: if the path is accepted here, it means OS and std::filesystem consider it valid. decided to keep it as is to preserve the original behaviour (e.g. model.suffix.extension to be converted into model_suffx name here)

}

for (size_t numberOfTestCase = 0; numberOfTestCase < inputFilesPerCase.size(); ++numberOfTestCase) {
Expand Down
Loading