Closed wangherr closed 4 months ago
https://github.com/huanranchen/DiffusionClassifier/blob/5b5b4b50d30d89501985cb20d38f1562014810ea/defenses/PurificationDefenses/DiffPure/DiffusionClassifier/DiffusionClassifier.py#L97
What is the purpose of dividing the gradient by (1000 / batchsize) here?
(1000 / batchsize)
Could you please explain why this factor 1000 is used and how it affects the gradient update process?
1000
Hi, since: total_loss = total_loss / (1000 / batchsize) therefore, x.grad = x.grad / (1000 / batchsize).
This does not have any impact on AutoPGD, since AutoPGD uses grad.sign().
https://github.com/huanranchen/DiffusionClassifier/blob/5b5b4b50d30d89501985cb20d38f1562014810ea/defenses/PurificationDefenses/DiffPure/DiffusionClassifier/DiffusionClassifier.py#L97
What is the purpose of dividing the gradient by
(1000 / batchsize)
here?Could you please explain why this factor
1000
is used and how it affects the gradient update process?