audio: Backprop does not work for lfilter

🐛 Bug

Gradients are not being backpropagated when using lfilter.

To Reproduce

Steps to reproduce the behavior:

  1. filtered = F.lfilter(x, a, b)

The command list(model.parameters())[0].grad returns None and the network weights are exactly the same after iterating through each batch.

Output of list(model.parameters())[0].grad: None None None …

Model weights: tensor([[ 0.0322, 0.0787, -0.0834, …, -0.0701, -0.0773, -0.0394], [-0.0378, -0.0445, 0.0642, …, 0.0215, 0.0875, -0.0312], [ 0.0328, 0.0955, -0.0069, …, 0.0831, -0.0243, 0.0969], …, [ 0.0587, -0.0371, 0.0228, …, -0.0462, 0.0787, -0.0234], [ 0.0719, 0.0537, 0.0785, …, -0.0930, -0.0149, -0.0980], [-0.0099, -0.0187, 0.0200, …, -0.0295, 0.0229, -0.0406]], device=‘cuda:0’)

tensor([[ 0.0322, 0.0787, -0.0834, …, -0.0701, -0.0773, -0.0394], [-0.0378, -0.0445, 0.0642, …, 0.0215, 0.0875, -0.0312], [ 0.0328, 0.0955, -0.0069, …, 0.0831, -0.0243, 0.0969], …, [ 0.0587, -0.0371, 0.0228, …, -0.0462, 0.0787, -0.0234], [ 0.0719, 0.0537, 0.0785, …, -0.0930, -0.0149, -0.0980], [-0.0099, -0.0187, 0.0200, …, -0.0295, 0.0229, -0.0406]], device=‘cuda:0’)

tensor([[ 0.0322, 0.0787, -0.0834, …, -0.0701, -0.0773, -0.0394], [-0.0378, -0.0445, 0.0642, …, 0.0215, 0.0875, -0.0312], [ 0.0328, 0.0955, -0.0069, …, 0.0831, -0.0243, 0.0969], …, [ 0.0587, -0.0371, 0.0228, …, -0.0462, 0.0787, -0.0234], [ 0.0719, 0.0537, 0.0785, …, -0.0930, -0.0149, -0.0980], [-0.0099, -0.0187, 0.0200, …, -0.0295, 0.0229, -0.0406]], device=‘cuda:0’)

Expected behavior

The command list(model.parameters())[0].grad should return a matrix and the network weights should get updated for each iteration.

Environment

  • What commands did you used to install torchaudio (conda/pip/build from source)? pip install torchaudio

  • If you are building from source, which commit is it? n/a

  • What does torchaudio.__version__ print? (If applicable) 0.8.1

  • PyTorch Version (e.g., 1.0): 1.8.1

  • OS (e.g., Linux): Ubuntu 18.04

  • Python version: Python 3.6.12

  • CUDA/cuDNN version: 11.2

  • GPU models and configuration: NVIDIA TITAN V

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16

Commits related to this issue

Most upvoted comments

Is there a function in torchaudio or pytorch that would allow me to apply a bank of 8 iir filters all at once without having to write a for loop?

I am not aware of one. @yoyololicon Do you know if there is any workaround?

Unfortunately, for-loop is probably the only solution for now. We do plan to support batched filter coefficients (see #1476 ), but it’s a little bit different from your application. I agree that multiple filter banks would be a good add-on feature.