Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 18, 2023
1 parent 749d441 commit ae79b16
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
2 changes: 0 additions & 2 deletions modulation/data/signal_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def multifreq(x: numpy.ndarray) -> numpy.ndarray:


def triangle(x: numpy.ndarray, section_length: float = 0.5) -> numpy.ndarray:

section0 = x < section_length
section1 = (x >= section_length) & (x < 2 * section_length)
section2 = (x >= 2 * section_length) & (x < 3 * section_length)
Expand All @@ -40,7 +39,6 @@ def triangle(x: numpy.ndarray, section_length: float = 0.5) -> numpy.ndarray:


def sawtooth(x: numpy.ndarray, section_length: float = 0.5) -> numpy.ndarray:

section0 = x < section_length
section1 = (x >= section_length) & (x < 2 * section_length)
section2 = (x >= 2 * section_length) & (x < 3 * section_length)
Expand Down
14 changes: 0 additions & 14 deletions tests/regression/reconstruction/torch_audio_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class TestFunctional(unittest.TestCase):
waveform_train, sr_train = torchaudio.load(test_filepath)

def test_torchscript_spectrogram(self):

tensor = torch.rand((1, 1000))
n_fft = 400
ws = 400
Expand Down Expand Up @@ -92,7 +91,6 @@ def test_torchscript_griffinlim(self):
)

def test_batch_griffinlim(self):

torch.random.manual_seed(42)
tensor = torch.rand((1, 201, 6))

Expand Down Expand Up @@ -423,7 +421,6 @@ def test_linearity_of_istft4(self):
self._test_linearity_of_istft(data_size, kwargs4, atol=1e-5, rtol=1e-8)

def test_batch_istft(self):

stft = torch.tensor(
[
[[4.0, 0.0], [4.0, 0.0], [4.0, 0.0], [4.0, 0.0], [4.0, 0.0]],
Expand All @@ -437,7 +434,6 @@ def test_batch_istft(self):
def _test_create_fb(
self, n_mels=40, sample_rate=22050, n_fft=2048, fmin=0.0, fmax=8000.0
):

librosa_fb = librosa.filters.mel(
sr=sample_rate,
n_fft=n_fft,
Expand Down Expand Up @@ -556,7 +552,6 @@ def test_pitch(self):
self._test_batch(F.detect_pitch_frequency, waveform, sample_rate)

def _test_batch_shape(self, functional, tensor, *args, **kwargs):

kwargs_compare = {}
if "atol" in kwargs:
atol = kwargs["atol"]
Expand Down Expand Up @@ -586,7 +581,6 @@ def _test_batch_shape(self, functional, tensor, *args, **kwargs):
return tensors, expected

def _test_batch(self, functional, tensor, *args, **kwargs):

tensors, expected = self._test_batch_shape(functional, tensor, *args, **kwargs)

kwargs_compare = {}
Expand All @@ -612,7 +606,6 @@ def _test_batch(self, functional, tensor, *args, **kwargs):
computed = functional(tensors.clone(), *args, **kwargs)

def test_torchscript_create_fb_matrix(self):

n_stft = 100
f_min = 0.0
f_max = 20.0
Expand All @@ -635,7 +628,6 @@ def test_torchscript_amplitude_to_DB(self):
)

def test_torchscript_DB_to_amplitude(self):

x = torch.rand((1, 100))
ref = 1.0
power = 1.0
Expand Down Expand Up @@ -685,36 +677,31 @@ def test_DB_to_amplitude(self):
self.assertTrue(torch.allclose(spec, x2, atol=5e-5))

def test_torchscript_create_dct(self):

n_mfcc = 40
n_mels = 128
norm = "ortho"

_test_torchscript_functional(F.create_dct, n_mfcc, n_mels, norm)

def test_torchscript_mu_law_encoding(self):

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

_test_torchscript_functional(F.mu_law_encoding, tensor, qc)

def test_torchscript_mu_law_decoding(self):

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

_test_torchscript_functional(F.mu_law_decoding, tensor, qc)

def test_torchscript_complex_norm(self):

complex_tensor = torch.randn(1, 2, 1025, 400, 2)
power = 2

_test_torchscript_functional(F.complex_norm, complex_tensor, power)

def test_mask_along_axis(self):

specgram = torch.randn(2, 1025, 400)
mask_param = 100
mask_value = 30.0
Expand All @@ -725,7 +712,6 @@ def test_mask_along_axis(self):
)

def test_mask_along_axis_iid(self):

specgrams = torch.randn(4, 2, 1025, 400)
mask_param = 100
mask_value = 30.0
Expand Down

0 comments on commit ae79b16

Please sign in to comment.