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
ccd78ffb
Unverified
Commit
ccd78ffb
authored
Nov 10, 2023
by
moto
Committed by
GitHub
Nov 10, 2023
Browse files
Warn if the input dtype to TimeStretch is not complex (#3695)
Addresses #3688
parent
172260f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
src/torchaudio/transforms/_transforms.py
src/torchaudio/transforms/_transforms.py
+7
-0
No files found.
src/torchaudio/transforms/_transforms.py
View file @
ccd78ffb
...
@@ -1066,6 +1066,13 @@ class TimeStretch(torch.nn.Module):
...
@@ -1066,6 +1066,13 @@ class TimeStretch(torch.nn.Module):
Stretched spectrogram. The resulting tensor is of the corresponding complex dtype
Stretched spectrogram. The resulting tensor is of the corresponding complex dtype
as the input spectrogram, and the number of frames is changed to ``ceil(num_frame / rate)``.
as the input spectrogram, and the number of frames is changed to ``ceil(num_frame / rate)``.
"""
"""
if
not
torch
.
is_complex
(
complex_specgrams
):
warnings
.
warn
(
"The input to TimeStretch must be complex type. "
"Providing non-complex tensor produces invalid results."
,
stacklevel
=
4
,
)
if
overriding_rate
is
None
:
if
overriding_rate
is
None
:
if
self
.
fixed_rate
is
None
:
if
self
.
fixed_rate
is
None
:
raise
ValueError
(
"If no fixed_rate is specified, must pass a valid rate to the forward method."
)
raise
ValueError
(
"If no fixed_rate is specified, must pass a valid rate to the forward method."
)
...
...
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