# Path: deep_verify/src/formulations/semidefinite/verify_dual_semidefinite.py
# _EPSILON = 1.e-12
#   SVD = 'svd'
#   WEAK = 'weak'
#   STRONG = 'strong'
#   STRONG_APPROX = 'strong_approx'
# class VerifyOption(str, Enum):
# class _InputLayer(layers.VerifiableLayer):
# class _CombinedLayer(layers.VerifiableLayer):
# class SemidefiniteDualFormulation(verify_dual_base.DualFormulation):
# class _ScaledGramComputation(layers.CustomOp):
#   def __init__(self, first_layer):
#   def input_node(self):
#   def output_node(self):
#   def reshape(self):
#   def dual_shape(self):
#   def reshape_duals_forwards(self, next_layer, dual_vars):
#   def project_duals_op(self, dual_vars):
#   def __init__(self, linear_layer, activation_layer):
#   def linear_layer(self):
#   def activation_layer(self):
#   def input_node(self):
#   def output_node(self):
#   def reshape(self):
#   def dual_shape(self):
#   def reshape_duals_forwards(self, next_layer, dual_vars):
#   def project_duals_op(self, dual_vars):
#   def group_layers(self, verifiable_layers):
#   def set_objective_computation_config(self, config):
#   def _get_dual_vars(self, dual_vars):
#   def expand_tensor(self, x, aug_size):
#   def dual_objective(self, verifiable_layers, labels, dual_var_lists,
#                      target_strategy=None, objective_computation_config=None):
#   def _layer_contrib(self, layer, dual_vars_lm1, dual_vars_l,
#                      dx_lm1, dx_l):
#   def _last_layer_contrib(self, layer, dual_vars_lm1, dx_lm1, obj_w, obj_b):
#   def _calc_w_norm(self, layer, x_lm1, beta_l, alpha_l):
#         def process_columns(x, beta_cur):
#   def _soft_abs(self, x):
#   def _softplus(self, x):
#   def __init__(self, abs_fn, block_size):
#   def visit_linear(self, layer, w, b, alpha, beta):
#   def visit_conv(self, layer, w, b, padding, strides, alpha, beta):
#   def visit_activation(self, layer):
# 
# Path: deep_verify/tests/formulations/verify_dual_base_test.py
# class _TestNet(snt.AbstractModule):
# class AvgPool(snt.AbstractModule):
# class DualFormulationTest(tf.test.TestCase, parameterized.TestCase):
#   def __init__(self, num_classes, build_fn):
#   def output_size(self):
#   def _build(self, image_batch):
#   def append(self, node, outputs, *inputs):
#   def output_module(self):
#   def dependencies(self, node):
#   def modules(self):
#   def fanout_of(self, node):
#   def propagate_bounds(self, input_bounds):
#   def __init__(self, kernel_shape, strides):
#   def kernel_shape(self):
#   def padding(self):
#   def strides(self):
#   def _build(self, value):
# def add_layer(net, module, inputs, flatten=False, batch_norm=None):
# def _linear_script(num_classes, net, layer_values):
# def _conv_script(num_classes, net, layer_values):
# def _conv_batchnorm_script(num_classes, net, layer_values):
# def _avgpool_script(num_classes, net, layer_values):
# def _avgpool_linear_script(num_classes, net, layer_values):
#   def _verification_strategy(self):
#   def _num_classes(self):
#   def _batch_size(self):
#   def _image_data(self):
#   def _network(self, model):
#   def _script_fn(self, model):
#   def _verifiable_layer_builder(self, net):
#   def _apply_verification(self, model, objective_computation_config=None):
#   def _build_objective(self, net, input_bounds, labels,
#                        boundprop_method=naive_bounds.NaiveBoundPropagation()):
#   def _expected_input_bounds(self, input_data, delta):
#   def _assert_dual_objective_close(self, expected_objective,
#                                    dual_obj, image_data):


from absl.testing import parameterized
from deep_verify.src.formulations.semidefinite import verify_dual_semidefinite
from deep_verify.tests.formulations import verify_dual_base_test
import tensorflow as tf
# coding=utf-8
# Copyright 2019 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for semidefinite formulation of dual verification."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function



class SemidefiniteDualFormulationTest(
    verify_dual_base_test.DualFormulationTest):

  def _verification_strategy(self):

# Path: deep_verify/src/formulations/semidefinite/verify_dual_semidefinite.py
# _EPSILON = 1.e-12
#   SVD = 'svd'
#   WEAK = 'weak'
#   STRONG = 'strong'
#   STRONG_APPROX = 'strong_approx'
# class VerifyOption(str, Enum):
# class _InputLayer(layers.VerifiableLayer):
# class _CombinedLayer(layers.VerifiableLayer):
# class SemidefiniteDualFormulation(verify_dual_base.DualFormulation):
# class _ScaledGramComputation(layers.CustomOp):
#   def __init__(self, first_layer):
#   def input_node(self):
#   def output_node(self):
#   def reshape(self):
#   def dual_shape(self):
#   def reshape_duals_forwards(self, next_layer, dual_vars):
#   def project_duals_op(self, dual_vars):
#   def __init__(self, linear_layer, activation_layer):
#   def linear_layer(self):
#   def activation_layer(self):
#   def input_node(self):
#   def output_node(self):
#   def reshape(self):
#   def dual_shape(self):
#   def reshape_duals_forwards(self, next_layer, dual_vars):
#   def project_duals_op(self, dual_vars):
#   def group_layers(self, verifiable_layers):
#   def set_objective_computation_config(self, config):
#   def _get_dual_vars(self, dual_vars):
#   def expand_tensor(self, x, aug_size):
#   def dual_objective(self, verifiable_layers, labels, dual_var_lists,
#                      target_strategy=None, objective_computation_config=None):
#   def _layer_contrib(self, layer, dual_vars_lm1, dual_vars_l,
#                      dx_lm1, dx_l):
#   def _last_layer_contrib(self, layer, dual_vars_lm1, dx_lm1, obj_w, obj_b):
#   def _calc_w_norm(self, layer, x_lm1, beta_l, alpha_l):
#         def process_columns(x, beta_cur):
#   def _soft_abs(self, x):
#   def _softplus(self, x):
#   def __init__(self, abs_fn, block_size):
#   def visit_linear(self, layer, w, b, alpha, beta):
#   def visit_conv(self, layer, w, b, padding, strides, alpha, beta):
#   def visit_activation(self, layer):
# 
# Path: deep_verify/tests/formulations/verify_dual_base_test.py
# class _TestNet(snt.AbstractModule):
# class AvgPool(snt.AbstractModule):
# class DualFormulationTest(tf.test.TestCase, parameterized.TestCase):
#   def __init__(self, num_classes, build_fn):
#   def output_size(self):
#   def _build(self, image_batch):
#   def append(self, node, outputs, *inputs):
#   def output_module(self):
#   def dependencies(self, node):
#   def modules(self):
#   def fanout_of(self, node):
#   def propagate_bounds(self, input_bounds):
#   def __init__(self, kernel_shape, strides):
#   def kernel_shape(self):
#   def padding(self):
#   def strides(self):
#   def _build(self, value):
# def add_layer(net, module, inputs, flatten=False, batch_norm=None):
# def _linear_script(num_classes, net, layer_values):
# def _conv_script(num_classes, net, layer_values):
# def _conv_batchnorm_script(num_classes, net, layer_values):
# def _avgpool_script(num_classes, net, layer_values):
# def _avgpool_linear_script(num_classes, net, layer_values):
#   def _verification_strategy(self):
#   def _num_classes(self):
#   def _batch_size(self):
#   def _image_data(self):
#   def _network(self, model):
#   def _script_fn(self, model):
#   def _verifiable_layer_builder(self, net):
#   def _apply_verification(self, model, objective_computation_config=None):
#   def _build_objective(self, net, input_bounds, labels,
#                        boundprop_method=naive_bounds.NaiveBoundPropagation()):
#   def _expected_input_bounds(self, input_data, delta):
#   def _assert_dual_objective_close(self, expected_objective,
#                                    dual_obj, image_data):


# Path: deep_verify/tests/formulations/semidefinite/verify_dual_semidefinite_test.py
from absl.testing import parameterized
from deep_verify.src.formulations.semidefinite import verify_dual_semidefinite
from deep_verify.tests.formulations import verify_dual_base_test
import tensorflow as tf

# coding=utf-8
# Copyright 2019 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for semidefinite formulation of dual verification."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function



class SemidefiniteDualFormulationTest(
    verify_dual_base_test.DualFormulationTest):

  def _verification_strategy(self):

    return verify_dual_semidefinite.SemidefiniteDualFormulation()