Skip to content

Add deprecation warning to MelScale if n_stft=0 #1511

@mthrok

Description

@mthrok

See #1510 for the context of this work.

We would like to issue a warning if the weight of T.MelScale is uninitialized.

For setting up dev env, please refer to CONTRIBUTING.md.

Steps

  1. In the constructor of T.MelScale, add warning if n_stft=0
    fb = torch.empty(0) if n_stft is None else F.create_fb_matrix(
    n_stft, self.f_min, self.f_max, self.n_mels, self.sample_rate, self.norm,
    self.mel_scale)
    self.register_buffer('fb', fb)
  2. In transform_test_impl.py, add a test method that constructs MelScale instance with n_stft=0 and the warning is issued. See this test for how to catch a warning.
  3. Run the test with
    (cd test && pytest torchaudio_unittest/transforms/transforms_*_test.py -k melscale)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions