Hi Ya’ll,
I am experiencing a somewhat spooky error, in which the simple act of loading a new state dictionary into my model seems to erase the graph tying parameters to an external matrix.
Here is the code, and I will explain below.
    for grad, (name, param) in zip(recovered, model.named_parameters()):
        updated_param = param - stepsize * grad  # This is 100% dependent on M
        new_state_dict[name] = updated_param

    model.load_state_dict(new_state_dict)
    l = list(model.parameters())
    test = ag.grad(l[0][0, 0], M, allow_unused=True)  # and somehow this is 100% NOT dependent on M

Essentially I need to do some manual SGD because of other computations I am doing with M (that is a matrix that is modifying gradients). Every gradient (which is in “recovered”) is dependent on M.
Here is the dillema
updated_param is dependent on M
for any name, the parameter contained in new_stat_dict[name] is dependent on M
but some how, that last test shows that none of the parameters in my model are dependent on M
Any thoughts on what is going on here would be super helpful!