code: def attack_whole_dataset(adversary, loader, device="cuda"):
      lst_adv = []
      lst_label = []
      lst_pred = []
      lst_advpred = []
      for data, label in loader:
          data, label = data.to(device), label.to(device)
          pred = predict_from_logits(adversary.predict(data))
          adv = adversary.perturb(data, label)
          advpred = predict_from_logits(adversary.predict(adv))
          lst_label.append(label)
          lst_pred.append(pred)
          lst_advpred.append(advpred)
          lst_adv.append(adv)
      return (
          torch.cat(lst_adv),
          torch.cat(lst_label),
          torch.cat(lst_pred),
          torch.cat(lst_advpred),
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import collections
  import numpy
  import torch
  from torch.distributions import laplace
  from torch.distributions import uniform
  from torch.nn.modules.loss import _Loss
  from advertorch.utils import clamp
  from advertorch.utils import clamp_by_pnorm
  from advertorch.utils import batch_multiply
  from advertorch.utils import normalize_by_pnorm
  from advertorch.utils import predict_from_logits
  from advertorch.loss import ZeroOneLoss
  from advertorch.attacks import Attack, LabelMixin
label_desc: Use image node_id 5 for calling a global function with example usage: attack_whole_dataset(adversary, loader, device) and returns: torch,  torch,  torch,  torch