Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question wdgrl.py - gradient_penalty(critic, h_s, h_t) #8

Open
fschmid56 opened this issue Aug 13, 2021 · 1 comment
Open

Question wdgrl.py - gradient_penalty(critic, h_s, h_t) #8

fschmid56 opened this issue Aug 13, 2021 · 1 comment

Comments

@fschmid56
Copy link

In wdgrl.py - gradient_penalty(critic, h_s, h_t): The interpolates created in line 29 are of size (3 x batch_size x feature_size). Following that the gradients are also of size (3 x batch_size x feature_size). When calculating gradients.norm(2, dim=1) in line 35 dimension 1 therefore refers to the batch_size dimension. Is this correct? Intuitively I would have done that across the feature dimension.

@shilianghe007
Copy link

I think the code is wrong. In my opinion, the code in Line 29 should be replaced with "interpolates = torch.cat([interpolates, h_s, h_t]).requires_grad_()"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants