What if I clone the model and do loss.backwards on that model?
for step_index in range(8):
    optimizer.step()
    temp_model = copy.deepcopy(model)
    temp_outputs = temp_model(X)
    cur_loss = loss_function(temp_outputs, y)
    temp_loss = cur_loss.item()
    cur_loss.backward()

Would that be an overkill? Also, since the goal is to calculate the L2 norm between these new gradients and the initial gradients, I could then just do:
    temp_totall2norm = 0
    for i, p1 in enumerate(model.parameters()):
        for j, p2 in enumerate(temp_model.parameters()):
            if i != j:
                continue
        temp_totall2norm += LA.norm(p1.grad.data.cpu().detach().clone() - p2.grad.data.cpu().detach().clone())

However, when I do run the above, strangely, the LA.norm line seems to be modifying the initial model (I get different results than when I don’t compute the L2 Norm ). Any idea why this is the case?