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

Algorithm problem #1

Open
wangzeyu135798 opened this issue Nov 10, 2020 · 2 comments
Open

Algorithm problem #1

wangzeyu135798 opened this issue Nov 10, 2020 · 2 comments

Comments

@wangzeyu135798
Copy link

Hi:
After reading your paper and code, I have a question.
In ogbn_protiens/attacks.py, function flag, I think it's the core of this algorithm. While In this function, you first calculate a loss under data and perturb, in next args.m -1 times, calculate args.m -1 times loss and accumulate gradients of perturb. In last, the total loss backwards. In your code, accumulating several times gradients of perturb while updating model parameters once. It seems that this doesn't match your paper!
In your paper algotithm1, from line 6 to 8, the adversarial loop run one time, computing both the gradient for perturb and parameter simultaneously.

@devnkong
Copy link
Owner

Hello, thanks for your interest in our paper!

The gradients will be accumulated for model parameters and perturbations M times in our algorithm. To way to realize it is to loss.backward() M times, but we only do gradient ascent for perturbations in the loop, without optimizing the model parameters. After we go outside the loop we optmize model parameter once. These match both our Algorithm 1 in the paper and our code.

Hope this makes sense!

@wangzeyu135798
Copy link
Author

wangzeyu135798 commented Dec 7, 2020 via email

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