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 that constructs minimization objective from dual variables.
docstr_tok: ["Function","that","constructs","minimization","objective","from","dual","variables","."]
code: def set_differentiable_objective(self):
      """Function that constructs minimization objective from dual variables."""
      # Checking if graphs are already created
      if self.vector_g is not None:
          return
  
      # Computing the scalar term
      bias_sum = 0
      for i in range(0, self.nn_params.num_hidden_layers):
          bias_sum = bias_sum + tf.reduce_sum(
              tf.multiply(
                  self.nn_params.biases[i], self.lambda_pos[i + 1]
              )
          )
      lu_sum = 0
      for i in range(0, self.nn_params.num_hidden_layers + 1):
          lu_sum = lu_sum + tf.reduce_sum(
              tf.multiply(
                  tf.multiply(self.lower[i], self.upper[i]),
                  self.lambda_lu[i],
              )
          )
  
      self.scalar_f = -bias_sum - lu_sum + self.final_constant
  
      # Computing the vector term
      g_rows = []
      for i in range(0, self.nn_params.num_hidden_layers):
          if i > 0:
              current_row = (
                  self.lambda_neg[i]
                  + self.lambda_pos[i]
                  - self.nn_params.forward_pass(
                      self.lambda_pos[i + 1], i, is_transpose=True
                  )
                  + tf.multiply(
                      self.lower[i] + self.upper[i], self.lambda_lu[i]
                  )
                  + tf.multiply(
                      self.lambda_quad[i], self.nn_params.biases[i - 1]
                  )
              )
          else:
              current_row = -self.nn_params.forward_pass(
                  self.lambda_pos[i + 1], i, is_transpose=True
              ) + tf.multiply(
                  self.lower[i] + self.upper[i], self.lambda_lu[i]
              )
          g_rows.append(current_row)
  
      # Term for final linear term
      g_rows.append(
          (
              self.lambda_pos[self.nn_params.num_hidden_layers]
              + self.lambda_neg[self.nn_params.num_hidden_layers]
              + self.final_linear
              + tf.multiply(
                  (
                      self.lower[self.nn_params.num_hidden_layers]
                      + self.upper[self.nn_params.num_hidden_layers]
                  ),
                  self.lambda_lu[self.nn_params.num_hidden_layers],
              )
              + tf.multiply(
                  self.lambda_quad[self.nn_params.num_hidden_layers],
                  self.nn_params.biases[
                      self.nn_params.num_hidden_layers - 1
                  ],
              )
          )
      )
      self.vector_g = tf.concat(g_rows, axis=0)
      self.unconstrained_objective = self.scalar_f + 0.5 * self.nu
  
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 4 for calling the DualFormulation obj's underlying member method code with example usage: obj.set_differentiable_objective() without return types