In previous versions we did something like:
for p in model.parameters():
    p.data.add_(-lr, p.grad.data)

Migration guide says that now using .data is unsafe, so how to rewrite this using .detach()?