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
35d68fdd
Unverified
Commit
35d68fdd
authored
Apr 09, 2021
by
Chin-Yun Yu
Committed by
GitHub
Apr 08, 2021
Browse files
Shorten lfilter autograd tests input size (#1443)
Use shorter input sequences to avoid time out error on CI
parent
0fbfca5c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
test/torchaudio_unittest/functional/autograd_impl.py
test/torchaudio_unittest/functional/autograd_impl.py
+14
-14
No files found.
test/torchaudio_unittest/functional/autograd_impl.py
View file @
35d68fdd
...
@@ -29,7 +29,7 @@ class Autograd(TestBaseMixin):
...
@@ -29,7 +29,7 @@ class Autograd(TestBaseMixin):
def
test_lfilter_x
(
self
):
def
test_lfilter_x
(
self
):
torch
.
random
.
manual_seed
(
2434
)
torch
.
random
.
manual_seed
(
2434
)
x
=
get_whitenoise
(
sample_rate
=
22050
,
duration
=
0.0
25
,
n_channels
=
2
)
x
=
get_whitenoise
(
sample_rate
=
22050
,
duration
=
0.0
1
,
n_channels
=
2
)
a
=
torch
.
tensor
([
0.7
,
0.2
,
0.6
])
a
=
torch
.
tensor
([
0.7
,
0.2
,
0.6
])
b
=
torch
.
tensor
([
0.4
,
0.2
,
0.9
])
b
=
torch
.
tensor
([
0.4
,
0.2
,
0.9
])
x
.
requires_grad
=
True
x
.
requires_grad
=
True
...
@@ -37,7 +37,7 @@ class Autograd(TestBaseMixin):
...
@@ -37,7 +37,7 @@ class Autograd(TestBaseMixin):
def
test_lfilter_a
(
self
):
def
test_lfilter_a
(
self
):
torch
.
random
.
manual_seed
(
2434
)
torch
.
random
.
manual_seed
(
2434
)
x
=
get_whitenoise
(
sample_rate
=
22050
,
duration
=
0.0
5
,
n_channels
=
2
)
x
=
get_whitenoise
(
sample_rate
=
22050
,
duration
=
0.0
1
,
n_channels
=
2
)
a
=
torch
.
tensor
([
0.7
,
0.2
,
0.6
])
a
=
torch
.
tensor
([
0.7
,
0.2
,
0.6
])
b
=
torch
.
tensor
([
0.4
,
0.2
,
0.9
])
b
=
torch
.
tensor
([
0.4
,
0.2
,
0.9
])
a
.
requires_grad
=
True
a
.
requires_grad
=
True
...
@@ -45,7 +45,7 @@ class Autograd(TestBaseMixin):
...
@@ -45,7 +45,7 @@ class Autograd(TestBaseMixin):
def
test_lfilter_b
(
self
):
def
test_lfilter_b
(
self
):
torch
.
random
.
manual_seed
(
2434
)
torch
.
random
.
manual_seed
(
2434
)
x
=
get_whitenoise
(
sample_rate
=
22050
,
duration
=
0.0
5
,
n_channels
=
2
)
x
=
get_whitenoise
(
sample_rate
=
22050
,
duration
=
0.0
1
,
n_channels
=
2
)
a
=
torch
.
tensor
([
0.7
,
0.2
,
0.6
])
a
=
torch
.
tensor
([
0.7
,
0.2
,
0.6
])
b
=
torch
.
tensor
([
0.4
,
0.2
,
0.9
])
b
=
torch
.
tensor
([
0.4
,
0.2
,
0.9
])
b
.
requires_grad
=
True
b
.
requires_grad
=
True
...
@@ -53,14 +53,14 @@ class Autograd(TestBaseMixin):
...
@@ -53,14 +53,14 @@ class Autograd(TestBaseMixin):
def
test_lfilter_all_inputs
(
self
):
def
test_lfilter_all_inputs
(
self
):
torch
.
random
.
manual_seed
(
2434
)
torch
.
random
.
manual_seed
(
2434
)
x
=
get_whitenoise
(
sample_rate
=
22050
,
duration
=
0.0
5
,
n_channels
=
2
)
x
=
get_whitenoise
(
sample_rate
=
22050
,
duration
=
0.0
1
,
n_channels
=
2
)
a
=
torch
.
tensor
([
0.7
,
0.2
,
0.6
])
a
=
torch
.
tensor
([
0.7
,
0.2
,
0.6
])
b
=
torch
.
tensor
([
0.4
,
0.2
,
0.9
])
b
=
torch
.
tensor
([
0.4
,
0.2
,
0.9
])
self
.
assert_grad
(
F
.
lfilter
,
(
x
,
a
,
b
))
self
.
assert_grad
(
F
.
lfilter
,
(
x
,
a
,
b
))
def
test_biquad
(
self
):
def
test_biquad
(
self
):
torch
.
random
.
manual_seed
(
2434
)
torch
.
random
.
manual_seed
(
2434
)
x
=
get_whitenoise
(
sample_rate
=
22050
,
duration
=
0.0
5
,
n_channels
=
2
)
x
=
get_whitenoise
(
sample_rate
=
22050
,
duration
=
0.0
1
,
n_channels
=
1
)
a
=
torch
.
tensor
([
0.7
,
0.2
,
0.6
])
a
=
torch
.
tensor
([
0.7
,
0.2
,
0.6
])
b
=
torch
.
tensor
([
0.4
,
0.2
,
0.9
])
b
=
torch
.
tensor
([
0.4
,
0.2
,
0.9
])
self
.
assert_grad
(
F
.
biquad
,
(
x
,
b
[
0
],
b
[
1
],
b
[
2
],
a
[
0
],
a
[
1
],
a
[
2
]))
self
.
assert_grad
(
F
.
biquad
,
(
x
,
b
[
0
],
b
[
1
],
b
[
2
],
a
[
0
],
a
[
1
],
a
[
2
]))
...
@@ -72,7 +72,7 @@ class Autograd(TestBaseMixin):
...
@@ -72,7 +72,7 @@ class Autograd(TestBaseMixin):
def
test_band_biquad
(
self
,
central_freq
,
Q
,
noise
):
def
test_band_biquad
(
self
,
central_freq
,
Q
,
noise
):
torch
.
random
.
manual_seed
(
2434
)
torch
.
random
.
manual_seed
(
2434
)
sr
=
22050
sr
=
22050
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
5
,
n_channels
=
2
)
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
1
,
n_channels
=
1
)
central_freq
=
torch
.
tensor
(
central_freq
)
central_freq
=
torch
.
tensor
(
central_freq
)
Q
=
torch
.
tensor
(
Q
)
Q
=
torch
.
tensor
(
Q
)
self
.
assert_grad
(
F
.
band_biquad
,
(
x
,
sr
,
central_freq
,
Q
,
noise
))
self
.
assert_grad
(
F
.
band_biquad
,
(
x
,
sr
,
central_freq
,
Q
,
noise
))
...
@@ -84,7 +84,7 @@ class Autograd(TestBaseMixin):
...
@@ -84,7 +84,7 @@ class Autograd(TestBaseMixin):
def
test_bass_biquad
(
self
,
central_freq
,
Q
,
gain
):
def
test_bass_biquad
(
self
,
central_freq
,
Q
,
gain
):
torch
.
random
.
manual_seed
(
2434
)
torch
.
random
.
manual_seed
(
2434
)
sr
=
22050
sr
=
22050
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
5
,
n_channels
=
2
)
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
1
,
n_channels
=
1
)
central_freq
=
torch
.
tensor
(
central_freq
)
central_freq
=
torch
.
tensor
(
central_freq
)
Q
=
torch
.
tensor
(
Q
)
Q
=
torch
.
tensor
(
Q
)
gain
=
torch
.
tensor
(
gain
)
gain
=
torch
.
tensor
(
gain
)
...
@@ -98,7 +98,7 @@ class Autograd(TestBaseMixin):
...
@@ -98,7 +98,7 @@ class Autograd(TestBaseMixin):
def
test_treble_biquad
(
self
,
central_freq
,
Q
,
gain
):
def
test_treble_biquad
(
self
,
central_freq
,
Q
,
gain
):
torch
.
random
.
manual_seed
(
2434
)
torch
.
random
.
manual_seed
(
2434
)
sr
=
22050
sr
=
22050
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
5
,
n_channels
=
2
)
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
1
,
n_channels
=
1
)
central_freq
=
torch
.
tensor
(
central_freq
)
central_freq
=
torch
.
tensor
(
central_freq
)
Q
=
torch
.
tensor
(
Q
)
Q
=
torch
.
tensor
(
Q
)
gain
=
torch
.
tensor
(
gain
)
gain
=
torch
.
tensor
(
gain
)
...
@@ -110,7 +110,7 @@ class Autograd(TestBaseMixin):
...
@@ -110,7 +110,7 @@ class Autograd(TestBaseMixin):
def
test_allpass_biquad
(
self
,
central_freq
,
Q
):
def
test_allpass_biquad
(
self
,
central_freq
,
Q
):
torch
.
random
.
manual_seed
(
2434
)
torch
.
random
.
manual_seed
(
2434
)
sr
=
22050
sr
=
22050
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
5
,
n_channels
=
2
)
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
1
,
n_channels
=
1
)
central_freq
=
torch
.
tensor
(
central_freq
)
central_freq
=
torch
.
tensor
(
central_freq
)
Q
=
torch
.
tensor
(
Q
)
Q
=
torch
.
tensor
(
Q
)
self
.
assert_grad
(
F
.
allpass_biquad
,
(
x
,
sr
,
central_freq
,
Q
))
self
.
assert_grad
(
F
.
allpass_biquad
,
(
x
,
sr
,
central_freq
,
Q
))
...
@@ -121,7 +121,7 @@ class Autograd(TestBaseMixin):
...
@@ -121,7 +121,7 @@ class Autograd(TestBaseMixin):
def
test_lowpass_biquad
(
self
,
cutoff_freq
,
Q
):
def
test_lowpass_biquad
(
self
,
cutoff_freq
,
Q
):
torch
.
random
.
manual_seed
(
2434
)
torch
.
random
.
manual_seed
(
2434
)
sr
=
22050
sr
=
22050
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
5
,
n_channels
=
2
)
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
1
,
n_channels
=
1
)
cutoff_freq
=
torch
.
tensor
(
cutoff_freq
)
cutoff_freq
=
torch
.
tensor
(
cutoff_freq
)
Q
=
torch
.
tensor
(
Q
)
Q
=
torch
.
tensor
(
Q
)
self
.
assert_grad
(
F
.
lowpass_biquad
,
(
x
,
sr
,
cutoff_freq
,
Q
))
self
.
assert_grad
(
F
.
lowpass_biquad
,
(
x
,
sr
,
cutoff_freq
,
Q
))
...
@@ -132,7 +132,7 @@ class Autograd(TestBaseMixin):
...
@@ -132,7 +132,7 @@ class Autograd(TestBaseMixin):
def
test_highpass_biquad
(
self
,
cutoff_freq
,
Q
):
def
test_highpass_biquad
(
self
,
cutoff_freq
,
Q
):
torch
.
random
.
manual_seed
(
2434
)
torch
.
random
.
manual_seed
(
2434
)
sr
=
22050
sr
=
22050
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
5
,
n_channels
=
2
)
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
1
,
n_channels
=
1
)
cutoff_freq
=
torch
.
tensor
(
cutoff_freq
)
cutoff_freq
=
torch
.
tensor
(
cutoff_freq
)
Q
=
torch
.
tensor
(
Q
)
Q
=
torch
.
tensor
(
Q
)
self
.
assert_grad
(
F
.
highpass_biquad
,
(
x
,
sr
,
cutoff_freq
,
Q
))
self
.
assert_grad
(
F
.
highpass_biquad
,
(
x
,
sr
,
cutoff_freq
,
Q
))
...
@@ -144,7 +144,7 @@ class Autograd(TestBaseMixin):
...
@@ -144,7 +144,7 @@ class Autograd(TestBaseMixin):
def
test_bandpass_biquad
(
self
,
central_freq
,
Q
,
const_skirt_gain
):
def
test_bandpass_biquad
(
self
,
central_freq
,
Q
,
const_skirt_gain
):
torch
.
random
.
manual_seed
(
2434
)
torch
.
random
.
manual_seed
(
2434
)
sr
=
22050
sr
=
22050
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
5
,
n_channels
=
2
)
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
1
,
n_channels
=
1
)
central_freq
=
torch
.
tensor
(
central_freq
)
central_freq
=
torch
.
tensor
(
central_freq
)
Q
=
torch
.
tensor
(
Q
)
Q
=
torch
.
tensor
(
Q
)
self
.
assert_grad
(
F
.
bandpass_biquad
,
(
x
,
sr
,
central_freq
,
Q
,
const_skirt_gain
))
self
.
assert_grad
(
F
.
bandpass_biquad
,
(
x
,
sr
,
central_freq
,
Q
,
const_skirt_gain
))
...
@@ -156,7 +156,7 @@ class Autograd(TestBaseMixin):
...
@@ -156,7 +156,7 @@ class Autograd(TestBaseMixin):
def
test_equalizer_biquad
(
self
,
central_freq
,
Q
,
gain
):
def
test_equalizer_biquad
(
self
,
central_freq
,
Q
,
gain
):
torch
.
random
.
manual_seed
(
2434
)
torch
.
random
.
manual_seed
(
2434
)
sr
=
22050
sr
=
22050
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
5
,
n_channels
=
2
)
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
1
,
n_channels
=
1
)
central_freq
=
torch
.
tensor
(
central_freq
)
central_freq
=
torch
.
tensor
(
central_freq
)
Q
=
torch
.
tensor
(
Q
)
Q
=
torch
.
tensor
(
Q
)
gain
=
torch
.
tensor
(
gain
)
gain
=
torch
.
tensor
(
gain
)
...
@@ -168,7 +168,7 @@ class Autograd(TestBaseMixin):
...
@@ -168,7 +168,7 @@ class Autograd(TestBaseMixin):
def
test_bandreject_biquad
(
self
,
central_freq
,
Q
):
def
test_bandreject_biquad
(
self
,
central_freq
,
Q
):
torch
.
random
.
manual_seed
(
2434
)
torch
.
random
.
manual_seed
(
2434
)
sr
=
22050
sr
=
22050
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
5
,
n_channels
=
2
)
x
=
get_whitenoise
(
sample_rate
=
sr
,
duration
=
0.0
1
,
n_channels
=
1
)
central_freq
=
torch
.
tensor
(
central_freq
)
central_freq
=
torch
.
tensor
(
central_freq
)
Q
=
torch
.
tensor
(
Q
)
Q
=
torch
.
tensor
(
Q
)
self
.
assert_grad
(
F
.
bandreject_biquad
,
(
x
,
sr
,
central_freq
,
Q
))
self
.
assert_grad
(
F
.
bandreject_biquad
,
(
x
,
sr
,
central_freq
,
Q
))
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