"vscode:/vscode.git/clone" did not exist on "dcb23b2d7299708442aee5b4dbf23ee6df363f2c"
Commit bcba1814 authored by Jason Lian's avatar Jason Lian
Browse files

Add assertion to check type of input

parent 3f89b7ce
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment