adrianjav/rotograd

No assignment for “self.grads”

Closed this issue · 1 comments

Thanks for your good job!
I don’t find any assignment for “self.grads” in RotateOnly so the “self.grads” remains None when running _rep_grad, is there any solution?
2

Hi @onlyyao

self.grads is assigned in a backward_hook in each task-specific RotateModule:

def hook(self, g):
self.p.grads[self.item] = g.clone()

These RotateModules are added to your architecture here:

for i in range(num_tasks):
heads[i] = nn.Sequential(RotateModule(self, i), heads[i])

Are you using the model as described in the readme file? That is, using preds = model(x) to get your predictions?