Skip to content

Commit bbb92cf

Browse files
authored
Merge pull request #2135 from SignedQiu/signedqiu
Fix Tensor Device Inconsistencies in PGD
2 parents d6f190f + 60744cf commit bbb92cf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

art/attacks/evasion/projected_gradient_descent/projected_gradient_descent_pytorch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def _generate_batch(
269269
inputs = x.to(self.estimator.device)
270270
targets = targets.to(self.estimator.device)
271271
adv_x = torch.clone(inputs)
272-
momentum = torch.zeros(inputs.shape)
272+
momentum = torch.zeros(inputs.shape).to(self.estimator.device)
273273

274274
if mask is not None:
275275
mask = mask.to(self.estimator.device)

0 commit comments

Comments
 (0)