Note that the .data here is not useful either 
Also you can print print(model.mu.grad) to see if you actually get gradients for it.
In particular, you want to make sure that your function structure does not make the gradients always 0 here.