class_docstr: The Carlini and Wagner L2 Attack, https://arxiv.org/abs/1608.04644
  
  :param predict: forward pass function.
  :param num_classes: number of clasess.
  :param confidence: confidence of the adversarial examples.
  :param targeted: if the attack is targeted.
  :param learning_rate: the learning rate for the attack algorithm
  :param binary_search_steps: number of binary search times to find the
      optimum
  :param max_iterations: the maximum number of iterations
  :param abort_early: if set to true, abort early if getting stuck in local
      min
  :param initial_const: initial value of the constant c
  :param clip_min: mininum value per input dimension.
  :param clip_max: maximum value per input dimension.
  :param loss_fn: loss function
class_docstr_tok: ["The","Carlini","and","Wagner","L2","Attack",",","https",":","\/\/arxiv.org\/abs\/1608.04644",":","param","predict",":","forward","pass","function",".",":","param","num_classes",":","number","of","clasess",".",":","param","confidence",":","confidence","of","the","adversarial","examples",".",":","param","targeted",":","if","the","attack","is","targeted",".",":","param","learning_rate",":","the","learning","rate","for","the","attack","algorithm",":","param","binary_search_steps",":","number","of","binary","search","times","to","find","the","optimum",":","param","max_iterations",":","the","maximum","number","of","iterations",":","param","abort_early",":","if","set","to","true",",","abort","early","if","getting","stuck","in","local","min",":","param","initial_const",":","initial","value","of","the","constant","c",":","param","clip_min",":","mininum","value","per","input","dimension",".",":","param","clip_max",":","maximum","value","per","input","dimension",".",":","param","loss_fn",":","loss","function"]
code: def _update_if_smaller_dist_succeed(
      self,
      adv_img,
      labs,
      output,
      l2distsq,
      batch_size,
      cur_l2distsqs,
      cur_labels,
      final_l2distsqs,
      final_labels,
      final_advs,
  ):
      target_label = labs
      output_logits = output
      _, output_label = torch.max(output_logits, 1)
  
      mask = (l2distsq < cur_l2distsqs) & self._is_successful(
          output_logits, target_label, True
      )
  
      cur_l2distsqs[mask] = l2distsq[mask]  # redundant
      cur_labels[mask] = output_label[mask]
  
      mask = (l2distsq < final_l2distsqs) & self._is_successful(
          output_logits, target_label, True
      )
      final_l2distsqs[mask] = l2distsq[mask]
      final_labels[mask] = output_label[mask]
      final_advs[mask] = adv_img[mask]
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import torch
  import torch.nn
  import torch.optim
  from advertorch.utils import calc_l2distsq
  from advertorch.utils import tanh_rescale
  from advertorch.utils import torch_arctanh
  from advertorch.utils import clamp
  from advertorch.utils import to_one_hot
  from advertorch.utils import replicate_input
  from .base import Attack
  from .base import LabelMixin
  from .utils import is_successful
label_desc: Use image node_id 6 for calling the CarliniWagnerL2Attack obj's underlying member method code with example usage: obj._update_if_smaller_dist_succeed(adv_img, labs, output, l2distsq, batch_size, cur_l2distsqs, cur_labels, final_l2distsqs, final_labels, final_advs) without return types