WeiChengTseng / Pytorch-PCGrad

Pytorch reimplementation for "Gradient Surgery for Multi-Task Learning"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gradient visualization

chengjianhong opened this issue · comments

@WeiChengTseng

Dear Wei-Cheng,

Is there any way to visualize the gradient change? I want to visualize them to further illustrate the superiority.

Best wishes,

Jianhong Cheng

I think you can directly use the following code to see the scale of the gradient.

for p in model.parameters():
    param_norm = p.grad.data.norm(2)
    total_norm += param_norm.item() ** 2
total_norm = total_norm ** (1. / 2)

I close this issue since there is no follow-up information.

Dear Wei-Cheng,
Thanks for your interesting work. For example , i have two losses. How should i draw picture like Figure 1 in the paper?

Best reagrds,
Bizhe