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
"git@developer.sourcefind.cn:OpenDAS/torchaudio.git" did not exist on "55ce80b1189070a666c2262189f33c38cec3ff7c"
Commit
bcba1814
authored
May 20, 2019
by
Jason Lian
Browse files
Add assertion to check type of input
parent
3f89b7ce
Changes
1
Hide 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):
...
@@ -316,6 +316,7 @@ def mu_law_encoding(x, qc):
Outputs:
Outputs:
Tensor: Input after mu-law companding
Tensor: Input after mu-law companding
"""
"""
assert
(
isinstance
(
x
,
torch
.
Tensor
)),
'mu_law_encoding expects a Tensor'
mu
=
qc
-
1.
mu
=
qc
-
1.
if
not
x
.
dtype
.
is_floating_point
:
if
not
x
.
dtype
.
is_floating_point
:
x
=
x
.
to
(
torch
.
float
)
x
=
x
.
to
(
torch
.
float
)
...
@@ -341,6 +342,7 @@ def mu_law_expanding(x_mu, qc):
...
@@ -341,6 +342,7 @@ def mu_law_expanding(x_mu, qc):
Outputs:
Outputs:
Tensor: Input after decoding
Tensor: Input after decoding
"""
"""
assert
(
isinstance
(
x_mu
,
torch
.
Tensor
)),
'mu_law_expanding expects a Tensor'
mu
=
qc
-
1.
mu
=
qc
-
1.
if
not
x_mu
.
dtype
.
is_floating_point
:
if
not
x_mu
.
dtype
.
is_floating_point
:
x_mu
=
x_mu
.
to
(
torch
.
float
)
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