Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Torchaudio
Commits
3c3ce998
Commit
3c3ce998
authored
Feb 03, 2019
by
Jeremy Howard
Committed by
Soumith Chintala
Feb 03, 2019
Browse files
stringify filename on load for compatibility with pathlib
parent
8b616bce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
torchaudio/__init__.py
torchaudio/__init__.py
+3
-1
No files found.
torchaudio/__init__.py
View file @
3c3ce998
...
...
@@ -26,7 +26,7 @@ def load(filepath,
"""Loads an audio file from disk into a Tensor
Args:
filepath (string): path to audio file
filepath (string
or pathlib.Path
): path to audio file
out (Tensor, optional): an output Tensor to use instead of creating one
normalization (bool, number, or callable, optional): If boolean `True`, then output is divided by `1 << 31`
(assumes signed 32-bit audio), and normalizes to `[0, 1]`.
...
...
@@ -60,6 +60,8 @@ def load(filepath,
1.
"""
# stringify if `pathlib.Path` (noop if already `str`)
filepath
=
str
(
filepath
)
# check if valid file
if
not
os
.
path
.
isfile
(
filepath
):
raise
OSError
(
"{} not found or is a directory"
.
format
(
filepath
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment