# Path: tensorflow_constrained_optimization/python/constrained_minimization_problem.py
# class ConstrainedMinimizationProblem(tf.Module):
#   def __init__(self, name=None):
#   def objective(self):
#   def num_constraints(self):
#   def constraints(self):
#   def proxy_constraints(self):
#   def components(self):
#   def update_ops(self):
# 
# Path: tensorflow_constrained_optimization/python/rates/constraint.py
# class Constraint(helpers.RateObject):
# class ConstraintList(helpers.UniqueList):
#   def __init__(self, expression):
#   def expression(self):
#   def __init__(self, collection=None):
# 
# Path: tensorflow_constrained_optimization/python/rates/defaults.py
# DENOMINATOR_LOWER_BOUND_KEY = "denominator_lower_bound"
# GLOBAL_STEP_KEY = "global_step"
# VARIABLE_FN_KEY = "variable_fn"
# DEFAULT_PENALTY_LOSS = loss.HingeLoss()
# DEFAULT_CONSTRAINT_LOSS = loss.ZeroOneLoss()
# 
# Path: tensorflow_constrained_optimization/python/rates/deferred_tensor.py
# class _DeferredTensorInput(helpers.RateObject):
# class DeferredTensor(helpers.RateObject):
# class _DerivedDeferredTensor(DeferredTensor):
# class ExplicitDeferredTensor(DeferredTensor):
# class DeferredVariable(DeferredTensor):
# class DeferredTensorInputList(helpers.RateObject):
# class DeferredVariableList(helpers.UniqueList):
#   def _list_to_tuple(cls, arg):
#   def __init__(self, value):
#   def value(self):
#   def __hash__(self):
#   def __eq__(self, other):
#   def __ne__(self, other):
#   def _value_and_auto_cast(self, structure_memoizer, value_memoizer):
#   def inputs(self):
#   def variables(self):
#   def __hash__(self):
#   def __eq__(self, other):
#   def __ne__(self, other):
#   def __call__(self, structure_memoizer, value_memoizer=None):
#   def apply(cls, callback, *args):
#   def __neg__(self):
#   def __lt__(self, other):
#   def __le__(self, other):
#   def __gt__(self, other):
#   def __ge__(self, other):
#   def __add__(self, other):
#   def __radd__(self, other):
#   def __sub__(self, other):
#   def __rsub__(self, other):
#   def __mul__(self, other):
#   def __rmul__(self, other):
#   def __truediv__(self, other):
#   def __rtruediv__(self, other):
#   def __getitem__(self, slice_spec):
#   def __init__(self, callback, args):
#   def _value_and_auto_cast(self, structure_memoizer, value_memoizer):
#   def inputs(self):
#   def variables(self):
#   def __hash__(self):
#   def __eq__(self, other):
#   def __init__(self, value, auto_cast=False):
#   def _value_and_auto_cast(self, structure_memoizer, value_memoizer):
#   def inputs(self):
#   def variables(self):
#   def __hash__(self):
#   def __eq__(self, other):
#   def __init__(self,
#                initial_value,
#                trainable=None,
#                name=None,
#                dtype=None,
#                constraint=None,
#                update_ops_fn=None,
#                auto_cast=False):
#   def _value_and_auto_cast(self, structure_memoizer, value_memoizer):
#   def inputs(self):
#   def variables(self):
#   def __hash__(self):
#   def __eq__(self, other):
#   def create(self, structure_memoizer):
#   def update_ops(self, structure_memoizer, value_memoizer=None):
#   def __init__(self, collection=None):
#   def list(self):
#   def append(self, element):
#   def __eq__(self, other):
#   def __ne__(self, other):
#   def __len__(self):
#   def __iter__(self):
#   def __add__(self, other):
#   def __radd__(self, other):
#   def __getitem__(self, slice_spec):
#   def __init__(self, collection=None):


import tensorflow as tf
from tensorflow_constrained_optimization.python import constrained_minimization_problem
from tensorflow_constrained_optimization.python.rates import constraint
from tensorflow_constrained_optimization.python.rates import defaults
from tensorflow_constrained_optimization.python.rates import deferred_tensor
    variables = deferred_tensor.DeferredVariableList()
    constraints = constraint.ConstraintList(constraints)

    # We make our own global_step, for keeping track of the denominators. We
    # don't take one as a parameter since we want complete ownership, to avoid
    # any shenanigans: it has to start at zero, and be incremented after every
    # minibatch.
    self._global_step = variable_fn(
        0,
        trainable=False,
        name="tfco_global_step",
        dtype=tf.int64,
        aggregation=tf.VariableAggregation.ONLY_FIRST_REPLICA)

    # This structure_memoizer will remember and re-use certain intermediate
    # values, causing the TensorFlow graph we construct to contain fewer
    # redundancies than it would otherwise. Additionally, it will store any
    # slack variables or denominator variables that need to be created for the
    # optimization problem.
    #
    # Each DeferredVariable has an associated key, which maps (in the structure
    # memoizer) to the tf.Variable itself. However, since dicts with tuple keys
    # cannot be tracked by tf.Trackable (upon which tf.Module is based),
    # "self._structure_memoizer" is excluded from tracking via
    # "self._no_dependency" and "_TF_MODULE_IGNORED_PROPERTIES". We still need
    # the raw tf.Variables to be tracked though, so we create the
    # "self._raw_variables" list, at the end of this method.
    self._structure_memoizer = self._no_dependency({
        defaults.DENOMINATOR_LOWER_BOUND_KEY: denominator_lower_bound,
        defaults.GLOBAL_STEP_KEY: self._global_step,

# Path: tensorflow_constrained_optimization/python/constrained_minimization_problem.py
# class ConstrainedMinimizationProblem(tf.Module):
#   def __init__(self, name=None):
#   def objective(self):
#   def num_constraints(self):
#   def constraints(self):
#   def proxy_constraints(self):
#   def components(self):
#   def update_ops(self):
# 
# Path: tensorflow_constrained_optimization/python/rates/constraint.py
# class Constraint(helpers.RateObject):
# class ConstraintList(helpers.UniqueList):
#   def __init__(self, expression):
#   def expression(self):
#   def __init__(self, collection=None):
# 
# Path: tensorflow_constrained_optimization/python/rates/defaults.py
# DENOMINATOR_LOWER_BOUND_KEY = "denominator_lower_bound"
# GLOBAL_STEP_KEY = "global_step"
# VARIABLE_FN_KEY = "variable_fn"
# DEFAULT_PENALTY_LOSS = loss.HingeLoss()
# DEFAULT_CONSTRAINT_LOSS = loss.ZeroOneLoss()
# 
# Path: tensorflow_constrained_optimization/python/rates/deferred_tensor.py
# class _DeferredTensorInput(helpers.RateObject):
# class DeferredTensor(helpers.RateObject):
# class _DerivedDeferredTensor(DeferredTensor):
# class ExplicitDeferredTensor(DeferredTensor):
# class DeferredVariable(DeferredTensor):
# class DeferredTensorInputList(helpers.RateObject):
# class DeferredVariableList(helpers.UniqueList):
#   def _list_to_tuple(cls, arg):
#   def __init__(self, value):
#   def value(self):
#   def __hash__(self):
#   def __eq__(self, other):
#   def __ne__(self, other):
#   def _value_and_auto_cast(self, structure_memoizer, value_memoizer):
#   def inputs(self):
#   def variables(self):
#   def __hash__(self):
#   def __eq__(self, other):
#   def __ne__(self, other):
#   def __call__(self, structure_memoizer, value_memoizer=None):
#   def apply(cls, callback, *args):
#   def __neg__(self):
#   def __lt__(self, other):
#   def __le__(self, other):
#   def __gt__(self, other):
#   def __ge__(self, other):
#   def __add__(self, other):
#   def __radd__(self, other):
#   def __sub__(self, other):
#   def __rsub__(self, other):
#   def __mul__(self, other):
#   def __rmul__(self, other):
#   def __truediv__(self, other):
#   def __rtruediv__(self, other):
#   def __getitem__(self, slice_spec):
#   def __init__(self, callback, args):
#   def _value_and_auto_cast(self, structure_memoizer, value_memoizer):
#   def inputs(self):
#   def variables(self):
#   def __hash__(self):
#   def __eq__(self, other):
#   def __init__(self, value, auto_cast=False):
#   def _value_and_auto_cast(self, structure_memoizer, value_memoizer):
#   def inputs(self):
#   def variables(self):
#   def __hash__(self):
#   def __eq__(self, other):
#   def __init__(self,
#                initial_value,
#                trainable=None,
#                name=None,
#                dtype=None,
#                constraint=None,
#                update_ops_fn=None,
#                auto_cast=False):
#   def _value_and_auto_cast(self, structure_memoizer, value_memoizer):
#   def inputs(self):
#   def variables(self):
#   def __hash__(self):
#   def __eq__(self, other):
#   def create(self, structure_memoizer):
#   def update_ops(self, structure_memoizer, value_memoizer=None):
#   def __init__(self, collection=None):
#   def list(self):
#   def append(self, element):
#   def __eq__(self, other):
#   def __ne__(self, other):
#   def __len__(self):
#   def __iter__(self):
#   def __add__(self, other):
#   def __radd__(self, other):
#   def __getitem__(self, slice_spec):
#   def __init__(self, collection=None):


# Path: tensorflow_constrained_optimization/python/rates/rate_minimization_problem.py
import tensorflow as tf
from tensorflow_constrained_optimization.python import constrained_minimization_problem
from tensorflow_constrained_optimization.python.rates import constraint
from tensorflow_constrained_optimization.python.rates import defaults
from tensorflow_constrained_optimization.python.rates import deferred_tensor

    variables = deferred_tensor.DeferredVariableList()
    constraints = constraint.ConstraintList(constraints)

    # We make our own global_step, for keeping track of the denominators. We
    # don't take one as a parameter since we want complete ownership, to avoid
    # any shenanigans: it has to start at zero, and be incremented after every
    # minibatch.
    self._global_step = variable_fn(
        0,
        trainable=False,
        name="tfco_global_step",
        dtype=tf.int64,
        aggregation=tf.VariableAggregation.ONLY_FIRST_REPLICA)

    # This structure_memoizer will remember and re-use certain intermediate
    # values, causing the TensorFlow graph we construct to contain fewer
    # redundancies than it would otherwise. Additionally, it will store any
    # slack variables or denominator variables that need to be created for the
    # optimization problem.
    #
    # Each DeferredVariable has an associated key, which maps (in the structure
    # memoizer) to the tf.Variable itself. However, since dicts with tuple keys
    # cannot be tracked by tf.Trackable (upon which tf.Module is based),
    # "self._structure_memoizer" is excluded from tracking via
    # "self._no_dependency" and "_TF_MODULE_IGNORED_PROPERTIES". We still need
    # the raw tf.Variables to be tracked though, so we create the
    # "self._raw_variables" list, at the end of this method.
    self._structure_memoizer = self._no_dependency({
        defaults.DENOMINATOR_LOWER_BOUND_KEY: denominator_lower_bound,
        defaults.GLOBAL_STEP_KEY: self._global_step,

        defaults.VARIABLE_FN_KEY: variable_fn