Skip to content

Commit dfaf189

Browse files
authored
Fix a path problem in onnxruntime_perf_test (microsoft#21341)
### Description Resolve microsoft#21267 . onnxruntime_perf_test does not work properly if the input model path url is just a single filename without any path separator. For example, ``` ./onnxruntime_perf_test -t 10 model.onnx ``` The problem was introduced in microsoft#19196 by me.
1 parent 281ed8c commit dfaf189

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

onnxruntime/test/onnx/TestCase.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ class TestModelInfo {
5353
public:
5454
virtual const std::filesystem::path& GetModelUrl() const = 0;
5555
virtual std::filesystem::path GetDir() const {
56-
return GetModelUrl().parent_path();
56+
const auto& p = GetModelUrl();
57+
return p.has_parent_path() ? p.parent_path() : std::filesystem::current_path();
5758
}
5859
virtual const std::string& GetNodeName() const = 0;
5960
virtual const ONNX_NAMESPACE::ValueInfoProto* GetInputInfoFromModel(size_t i) const = 0;

0 commit comments

Comments
 (0)