-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Unify SIT file name deduction from a network path #34173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
| } | ||
|
|
||
| ov::Tensor loadImages(const ov::element::Type& precision, const ov::Shape& shape, const ov::Layout& layout, | ||
|
|
@@ -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()); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| } | ||
|
|
||
| for (size_t numberOfTestCase = 0; numberOfTestCase < inputFilesPerCase.size(); ++numberOfTestCase) { | ||
|
|
||
There was a problem hiding this comment.
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.