Pytorch-PCGrad
Pytorch-PCGrad copied to clipboard
went wrong in function _project_conflicting
hi! i have tried the pytorch-PCGrad in my project. my network was an mobilenetv2 followed by two task-head and these two task-head have different parameters. when i ran the pytorch-pcgrad, it went wrong.it seems that the separated backward process induce two gradient vectors with different length, thus went wrong in function _project_conflicting.
@leonzgtee Hi, thanks for the feedback. I already tackled the network that contains both shared and unshared parameters, so you can check whether it works for your scenario. In this implementation, the gradient of the unshared parameters remain the same, and the gradient of shared parameters is modified by PCGrad.
@WeiChengTseng thanks, but i notice that the shared in function _project_conflicting is stacked from has_grads,which may not only contain the shared parameters but also a branch of task parameters.