How to use the torchattacks.attacks.ifgsm.IFGSM function in torchattacks

To help you get started, we’ve selected a few torchattacks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Harry24k / adversairal-attacks-pytorch / torchattacks / attacks / ifgsm.py View on Github external
def __init__(self, model, eps=4/255, alpha=1/255, iters=0):
        super(IFGSM, self).__init__("IFGSM", model)
        self.eps = eps
        self.alpha = alpha
        if iters == 0 :
            self.iters = int(min(eps*255 + 4, 1.25*eps*255))
        else :
            self.iters = iters