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
7aac931e
"docs/vscode:/vscode.git/clone" did not exist on "17e1ec4e5b77a7df011b242fd18623c912ed14b3"
Unverified
Commit
7aac931e
authored
Feb 10, 2021
by
jieruan
Committed by
GitHub
Feb 10, 2021
Browse files
Fix transducer test skip logic (#1253)
parent
7ee1c46b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
test/torchaudio_unittest/transducer_test.py
test/torchaudio_unittest/transducer_test.py
+12
-3
No files found.
test/torchaudio_unittest/transducer_test.py
View file @
7aac931e
import
unittest
import
torch
from
torchaudio.prototype.transducer
import
RNNTLoss
from
torchaudio_unittest
import
common_utils
from
torchaudio_unittest
.common_utils
import
TorchaudioTestCase
def
get_data_basic
(
device
):
...
...
@@ -241,6 +242,14 @@ def compute_with_pytorch_transducer(data):
return
costs
,
gradients
def
skipIfNoTransducer
(
test_item
):
try
:
torch
.
ops
.
torchaudio
.
rnnt_loss
return
test_item
except
RuntimeError
:
return
unittest
.
skip
(
"torchaudio C++ extension is not compiled with RNN transducer loss"
)(
test_item
)
class
TransducerTester
:
def
test_basic_fp16_error
(
self
):
rnnt_loss
=
RNNTLoss
()
...
...
@@ -271,6 +280,6 @@ class TransducerTester:
self
.
assertEqual
(
gradients
,
ref_gradients
,
atol
=
atol
,
rtol
=
rtol
)
@
common_utils
.
skipIfNoExtension
class
CPUTransducerTester
(
TransducerTester
,
common_utils
.
Pytorch
TestCase
):
@
skipIfNoTransducer
class
CPUTransducerTester
(
TransducerTester
,
Torchaudio
TestCase
):
device
=
"cpu"
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