Skip to content

Commit a0dbae2

Browse files
committed
Adding black formatting
Signed-off-by: Shriti Priya <[email protected]>
1 parent 8ed4291 commit a0dbae2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

art/attacks/poisoning/sleeper_agent_attack.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,11 @@ def select_poison_indices(
384384
model.eval()
385385
differentiable_params = [p for p in classifier.model.parameters() if p.requires_grad]
386386
for x, y in zip(x_samples, y_samples):
387-
image = torch.tensor(x,dtype=torch.float32).float().to(device)
387+
image = torch.tensor(x, dtype=torch.float32).float().to(device)
388388
label = torch.tensor(y).to(device)
389389
loss = criterion(model(image.unsqueeze(0)), label.unsqueeze(0))
390390
gradients = torch.autograd.grad(loss, differentiable_params, only_inputs=True)
391-
grad_norm = torch.tensor(0,dtype=torch.float32).to(device)
391+
grad_norm = torch.tensor(0, dtype=torch.float32).to(device)
392392
for grad in gradients:
393393
grad_norm += grad.detach().pow(2).sum()
394394
grad_norms.append(grad_norm.sqrt())

0 commit comments

Comments
 (0)