class_docstr: DualFormulation is a class that creates the dual objective function
  and access to matrix vector products for the matrix that is constrained
  to be Positive semidefinite
class_docstr_tok: ["DualFormulation","is","a","class","that","creates","the","dual","objective","function","and","access","to","matrix","vector","products","for","the","matrix","that","is","constrained","to","be","Positive","semidefinite"]
docstr: Function to create variables for the projected dual object.
  Function that projects the input dual variables onto the feasible set.
  Returns:
    projected_dual: Feasible dual solution corresponding to current dual
docstr_tok: ["Function","to","create","variables","for","the","projected","dual","object",".","Function","that","projects","the","input","dual","variables","onto","the","feasible","set",".","Returns",":","projected_dual",":","Feasible","dual","solution","corresponding","to","current","dual"]
code: def create_projected_dual(self):
      """Function to create variables for the projected dual object.
      Function that projects the input dual variables onto the feasible set.
      Returns:
        projected_dual: Feasible dual solution corresponding to current dual
      """
      # TODO: consider whether we can use shallow copy of the lists without
      # using tf.identity
      projected_nu = tf.placeholder(tf.float32, shape=[])
      min_eig_h = tf.placeholder(tf.float32, shape=[])
      projected_lambda_pos = [tf.identity(x) for x in self.lambda_pos]
      projected_lambda_neg = [tf.identity(x) for x in self.lambda_neg]
      projected_lambda_quad = [tf.identity(x) for x in self.lambda_quad]
      projected_lambda_lu = [tf.identity(x) for x in self.lambda_lu]
  
      for i in range(self.nn_params.num_hidden_layers + 1):
          # Making H PSD
          projected_lambda_lu[i] = (
              self.lambda_lu[i] + 0.5 * tf.maximum(-min_eig_h, 0) + TOL
          )
          # Adjusting the value of \lambda_neg to make change in g small
          projected_lambda_neg[i] = self.lambda_neg[i] + tf.multiply(
              (self.lower[i] + self.upper[i]),
              (self.lambda_lu[i] - projected_lambda_lu[i]),
          )
          projected_lambda_neg[i] = tf.multiply(
              self.negative_indices[i], projected_lambda_neg[i]
          ) + tf.multiply(
              self.switch_indices[i],
              tf.maximum(projected_lambda_neg[i], 0),
          )
  
      projected_dual_var = {
          "lambda_pos": projected_lambda_pos,
          "lambda_neg": projected_lambda_neg,
          "lambda_lu": projected_lambda_lu,
          "lambda_quad": projected_lambda_quad,
          "nu": projected_nu,
      }
      projected_dual_object = DualFormulation(
          self.sess,
          projected_dual_var,
          self.nn_params,
          self.test_input,
          self.true_class,
          self.adv_class,
          self.input_minval,
          self.input_maxval,
          self.epsilon,
          self.lzs_params,
          project_dual=False,
      )
      projected_dual_object.min_eig_val_h = min_eig_h
      return projected_dual_object
  
file_path: cleverhans/cleverhans_v3.1.0/cleverhans/experimental/certification/dual_formulation.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from scipy.sparse.linalg import eigs, LinearOperator
  import tensorflow
  from tensorflow.contrib import autograph
  import numpy
  from cleverhans.experimental.certification import utils
label_desc: Use image node_id 2 for calling the DualFormulation obj's underlying member method code with example usage: obj.create_projected_dual() and returns: projected_dual_object