Hi, not sure this is the right category to post, but it is surely related to how autograd works. I need to better understand how requires_grad is set to False or True by the torch engine and why the loss.backward() and optimizer.step() sometimes complains that during backprop some tensor have grad False and sometimes not.
I am developing a class for sound synthesis that takes a tensor of parameters and translate these into a time-domain (i.e. the sound). The signal must be generated by iterating a for loop (we use a physical model, so there is no way to avoid the iterations). Everything is done using torch operations, from the input tensor to the output, and this class indeed manages to get the output from a NN and synthesize sound. By inspecting the model parameters, however, they are all tensors with requires_grad=False. Indeed list(model.parameters()).grad is False, and the network weights stay the same at each iteration, but torch can compute the graph. Why?
What are smart ways to build custom code that is differentiable?
BTW: in the past using keras we were able to conduct entire simulations of room impulse responses, convolutions and FFT without problems. But with keras you don’t know what happens under the hood.