mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-09 00:30:53 +00:00
Use os.fspath on Path (#15530)
### Description <!-- Describe your changes. --> Use os.fspath instead of str() on a path object. ### Motivation and Context I learned today that os.fspath is the right way to go: https://github.com/charliermarsh/ruff/issues/3675#issuecomment-1494975508
This commit is contained in:
parent
a30b57da6e
commit
9d26f8f4fe
1 changed files with 2 additions and 5 deletions
|
|
@ -359,11 +359,8 @@ class InferenceSession(Session):
|
|||
"""
|
||||
super().__init__()
|
||||
|
||||
if isinstance(path_or_bytes, str):
|
||||
self._model_path = path_or_bytes
|
||||
self._model_bytes = None
|
||||
elif isinstance(path_or_bytes, os.PathLike):
|
||||
self._model_path = str(path_or_bytes)
|
||||
if isinstance(path_or_bytes, (str, os.PathLike)):
|
||||
self._model_path = os.fspath(path_or_bytes)
|
||||
self._model_bytes = None
|
||||
elif isinstance(path_or_bytes, bytes):
|
||||
self._model_path = None
|
||||
|
|
|
|||
Loading…
Reference in a new issue