docstr: oscillator_bank returns the matching values as reference implementation
  
  Note: It looks like NumPy performs cumsum on higher precision and thus this test
  does not pass on float32.
docstr_tok: ["oscillator_bank","returns","the","matching","values","as","reference","implementation","Note",":","It","looks","like","NumPy","performs","cumsum","on","higher","precision","and","thus","this","test","does","not","pass","on","float32","."]
code: def test_oscillator_ref(self, f0, num_pitches, sample_rate):
      """oscillator_bank returns the matching values as reference implementation
  
      Note: It looks like NumPy performs cumsum on higher precision and thus this test
      does not pass on float32.
      """
      duration = 4.0
  
      num_frames = int(sample_rate * duration)
      freq0 = f0 * torch.arange(
          1, num_pitches + 1, device=self.device, dtype=self.dtype
      )
      amps = 1.0 / num_pitches * torch.ones_like(freq0)
  
      ones = torch.ones(
          [num_frames, num_pitches],
          device=self.device,
          dtype=self.dtype,
      )
      freq = ones * freq0[None, :]
      amps = ones * amps[None, :]
  
      wavs_ref = oscillator_bank_np(
          freq.cpu().numpy(), amps.cpu().numpy(), sample_rate
      )
      wavs_hyp = F.oscillator_bank(
          freq, amps, sample_rate, reduction="none"
      )
  
      # Debug code to see what goes wrong.
      # keeping it for future reference
      def _debug_plot():
          """
          import matplotlib.pyplot as plt
  
          fig, axes = plt.subplots(num_pitches, 3, sharex=True, sharey=True)
          for p in range(num_pitches):
              (ax0, ax1, ax2) = axes[p] if num_pitches > 1 else axes
              spec_ref, ys, xs, _ = ax0.specgram(wavs_ref[:, p])
              spec_hyp, _, _, _ = ax1.specgram(wavs_hyp[:, p])
              spec_diff = spec_ref - spec_hyp
              ax2.imshow(spec_diff, aspect="auto", extent=[xs[0], xs[-1], ys[0], ys[-1]])
          plt.show()
          """
          pass
  
      try:
          self.assertEqual(wavs_hyp, wavs_ref)
      except AssertionError:
          _debug_plot()
          raise
  
imports: import torch
  import torchaudio.prototype.functional
  from parameterized import param, parameterized
  from torchaudio_unittest.common_utils import nested_params, TestBaseMixin
  from .dsp_utils import exp_sigmoid, freq_ir, oscillator_bank, sinc_ir
label_desc: Use image node_id 1 for calling the Functional64OnlyTestImpl obj's underlying member method code with example usage: obj.test_oscillator_ref(f0, num_pitches, sample_rate) without return types