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
bcba1814
Commit
bcba1814
authored
May 20, 2019
by
Jason Lian
Browse files
Add assertion to check type of input
parent
3f89b7ce
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
torchaudio/functional.py
torchaudio/functional.py
+2
-0
No files found.
torchaudio/functional.py
View file @
bcba1814
...
...
@@ -316,6 +316,7 @@ def mu_law_encoding(x, qc):
Outputs:
Tensor: Input after mu-law companding
"""
assert
(
isinstance
(
x
,
torch
.
Tensor
)),
'mu_law_encoding expects a Tensor'
mu
=
qc
-
1.
if
not
x
.
dtype
.
is_floating_point
:
x
=
x
.
to
(
torch
.
float
)
...
...
@@ -341,6 +342,7 @@ def mu_law_expanding(x_mu, qc):
Outputs:
Tensor: Input after decoding
"""
assert
(
isinstance
(
x_mu
,
torch
.
Tensor
)),
'mu_law_expanding expects a Tensor'
mu
=
qc
-
1.
if
not
x_mu
.
dtype
.
is_floating_point
:
x_mu
=
x_mu
.
to
(
torch
.
float
)
...
...
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