Skip to content

Commit

Permalink
Fix a path problem in onnxruntime_perf_test (#21341)
Browse files Browse the repository at this point in the history
### Description
Resolve #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 #19196 by me.
  • Loading branch information
snnn authored Jul 15, 2024
1 parent 281ed8c commit dfaf189
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion onnxruntime/test/onnx/TestCase.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class TestModelInfo {
public:
virtual const std::filesystem::path& GetModelUrl() const = 0;
virtual std::filesystem::path GetDir() const {
return GetModelUrl().parent_path();
const auto& p = GetModelUrl();
return p.has_parent_path() ? p.parent_path() : std::filesystem::current_path();
}
virtual const std::string& GetNodeName() const = 0;
virtual const ONNX_NAMESPACE::ValueInfoProto* GetInputInfoFromModel(size_t i) const = 0;
Expand Down

0 comments on commit dfaf189

Please sign in to comment.