Skip to content

Commit 6a43e9e

Browse files
jamarshoncpuhrsch
authored andcommitted
Renaming MuLawExpanding to MuLawDecoding (#159)
1 parent b29a463 commit 6a43e9e

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

test/test_jit.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,25 +170,25 @@ def test_scriptmodule_MuLawEncoding(self):
170170

171171
self._test_script_module(tensor, transforms.MuLawEncoding)
172172

173-
def test_torchscript_mu_law_expanding(self):
173+
def test_torchscript_mu_law_decoding(self):
174174
@torch.jit.script
175175
def jit_method(tensor, qc):
176176
# type: (Tensor, int) -> Tensor
177-
return F.mu_law_expanding(tensor, qc)
177+
return F.mu_law_decoding(tensor, qc)
178178

179179
tensor = torch.rand((1, 10))
180180
qc = 256
181181

182182
jit_out = jit_method(tensor, qc)
183-
py_out = F.mu_law_expanding(tensor, qc)
183+
py_out = F.mu_law_decoding(tensor, qc)
184184

185185
self.assertTrue(torch.allclose(jit_out, py_out))
186186

187187
@unittest.skipIf(not RUN_CUDA, "no CUDA")
188-
def test_scriptmodule_MuLawExpanding(self):
188+
def test_scriptmodule_MuLawDecoding(self):
189189
tensor = torch.rand((1, 10), device="cuda")
190190

191-
self._test_script_module(tensor, transforms.MuLawExpanding)
191+
self._test_script_module(tensor, transforms.MuLawDecoding)
192192

193193

194194
if __name__ == '__main__':

test/test_transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def test_mu_law_companding(self):
6161
waveform_mu = transforms.MuLawEncoding(quantization_channels)(waveform)
6262
self.assertTrue(waveform_mu.min() >= 0. and waveform_mu.max() <= quantization_channels)
6363

64-
waveform_exp = transforms.MuLawExpanding(quantization_channels)(waveform_mu)
64+
waveform_exp = transforms.MuLawDecoding(quantization_channels)(waveform_mu)
6565
self.assertTrue(waveform_exp.min() >= -1. and waveform_exp.max() <= 1.)
6666

6767
def test_mel2(self):

torchaudio/functional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
'spectrogram_to_DB',
1111
'create_dct',
1212
'mu_law_encoding',
13-
'mu_law_expanding',
13+
'mu_law_decoding',
1414
'complex_norm',
1515
'angle',
1616
'magphase',
@@ -353,7 +353,7 @@ def mu_law_encoding(x, quantization_channels):
353353

354354

355355
@torch.jit.script
356-
def mu_law_expanding(x_mu, quantization_channels):
356+
def mu_law_decoding(x_mu, quantization_channels):
357357
# type: (Tensor, int) -> Tensor
358358
r"""Decode mu-law encoded signal. For more info see the
359359
`Wikipedia Entry <https://en.wikipedia.org/wiki/%CE%9C-law_algorithm>`_

torchaudio/transforms.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def forward(self, x):
321321
return F.mu_law_encoding(x, self.quantization_channels)
322322

323323

324-
class MuLawExpanding(torch.jit.ScriptModule):
324+
class MuLawDecoding(torch.jit.ScriptModule):
325325
r"""Decode mu-law encoded signal. For more info see the
326326
`Wikipedia Entry <https://en.wikipedia.org/wiki/%CE%9C-law_algorithm>`_
327327
@@ -334,7 +334,7 @@ class MuLawExpanding(torch.jit.ScriptModule):
334334
__constants__ = ['quantization_channels']
335335

336336
def __init__(self, quantization_channels=256):
337-
super(MuLawExpanding, self).__init__()
337+
super(MuLawDecoding, self).__init__()
338338
self.quantization_channels = quantization_channels
339339

340340
@torch.jit.script_method
@@ -346,7 +346,7 @@ def forward(self, x_mu):
346346
Returns:
347347
torch.Tensor: The signal decoded
348348
"""
349-
return F.mu_law_expanding(x_mu, self.quantization_channels)
349+
return F.mu_law_decoding(x_mu, self.quantization_channels)
350350

351351

352352
class Resample(torch.nn.Module):

0 commit comments

Comments
 (0)