Skip to content

Fast gradient Method doesn't work for double precision: Suggestion for the fix #1224

@williampiat3

Description

@williampiat3

The issue tracker should only be used to report bugs or feature requests. If you are looking for support from other library users, please ask a question on StackOverflow.

Describe the bug
I used the PGD method in this folder but I use double precision in my models thus encountered an error while using the attack
cleverhans/cleverhans/torch/attacks/projected_gradient_descent.py

I found a way of fixing the problem:
line 74 in cleverhans/cleverhans/torch/attacks/fast_gradient_method.py
instead of:

x = x.clone().detach().to(torch.float).requires_grad_(True)

I put

x = x.clone().detach().to(x.dtype).requires_grad_(True)

My solution then covers double precision and simple precision

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions