So does this only work for situations in which f2 is just a function/series of functions, and not itself dependent upon parameters which needs gradients? If f2 = lambda x: x * parameter where parameter is some tuneable parameters that needs a gradient, will the above code compute gradients for parameter and update it when I call optimizer.step()? If yes, then how would I modify the initial code I wrote above to work and update model parameters (even though I understand that it will not in fact be helpful to use it)?