class_docstr: Uses Adam to minimize the CW L2 objective function
  
  Paper link: https://arxiv.org/abs/1608.04644
class_docstr_tok: ["Uses","Adam","to","minimize","the","CW","L2","objective","function","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1608.04644"]
docstr: loss function for cw
  The components are L2 and f6
docstr_tok: ["loss","function","for","cw","The","components","are","L2","and","f6"]
code: def _loss_cwb(self, target, constrained, distance_L2, c):
      """
      loss function for cw
      The components are L2 and f6
      """
      self.logits = self._attack_model(constrained)
      self.softmax = fluid.layers.softmax(self.logits)
  
      self.negetive_screen_nontarget_logit = fluid.layers.scale(
          target, scale=-1.0
      )
      self.screen_target_logit = (
          self.negetive_screen_nontarget_logit.__add__(
              fluid.layers.ones(shape=[self._dim], dtype="float32")
          )
      )
  
      self.logits_i_not_t = fluid.layers.elementwise_mul(
          self.screen_target_logit, self.logits
      )
      self.logit_target = fluid.layers.elementwise_mul(
          target, self.logits
      )
  
      self.maxlogit_i_not_t = fluid.layers.reduce_max(
          self.logits_i_not_t
      )
      self.maxlogit_target = fluid.layers.reduce_sum(self.logit_target)
  
      self.softmax_target = fluid.layers.elementwise_mul(
          target, self.softmax
      )
      self.maxsoftmax_target = fluid.layers.reduce_sum(
          self.softmax_target
      )
  
      self.difference_between_two_logits = (
          self.maxlogit_i_not_t - self.maxlogit_target
      )
  
      self.soft_diff_two_logits = self.maxlogit_i_not_t * (
          self.confidence - self.maxsoftmax_target
      )
      self.f6 = fluid.layers.relu(
          self.difference_between_two_logits + self.soft_diff_two_logits
      )
  
      self.loss = c * self.f6 + distance_L2
  
      return self.loss, self.logits, self.softmax
  
file_path: AdvBox/adversarialbox/attacks/cw.py
imports: from __future__ import division
  from __future__ import print_function
  from builtins import range
  import logging
  import numpy
  import paddle.fluid
  from .base import Attack
label_desc: Use image node_id 5 for calling the CW_L2_Attack obj's underlying member method code with example usage: obj._loss_cwb(target, constrained, distance_L2, c) and returns: self,  self,  self