# Path: tensorflow_constrained_optimization/python/rates/basic_expression.py
# class BasicExpression(helpers.RateObject):
#   def _add_terms(self, source):
#   def _sub_terms(self, source):
#   def __init__(self, terms):
#   def is_differentiable(self):
#   def __mul__(self, scalar):
#   def __rmul__(self, scalar):
#   def __truediv__(self, scalar):
#   def __neg__(self):
#   def __add__(self, other):
#   def __sub__(self, other):
#   def evaluate(self, structure_memoizer):
# 
# 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/helpers.py
# class RateObject(object):
# class UniqueList(RateObject):
# def convert_to_1d_tensor(tensor, name=None):
# def get_num_columns_of_2d_tensor(tensor, name="tensor"):
# def get_num_elements_of_tensor(tensor, name="tensor"):
#   def __init__(self, collection=None, element_type=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):
# 
# Path: tensorflow_constrained_optimization/python/rates/term.py
# class _RatioWeights(helpers.RateObject):
# class Term(helpers.RateObject):
# class TensorTerm(Term):
# class BinaryClassificationTerm(Term):
# class MulticlassTerm(Term):
#   def __init__(self, ratios, num_columns):
#   def ratios(self):
#   def num_columns(self):
#   def ratio(cls, weights, column_coefficients, numerator_predicate,
#             denominator_predicate):
#     def value_fn(weights_value, predicate_value):
#   def __mul__(self, scalar):
#   def __rmul__(self, scalar):
#   def __truediv__(self, scalar):
#   def __neg__(self):
#   def __add__(self, other):
#   def __sub__(self, other):
#   def _evaluate_denominator(self, denominator, structure_memoizer):
#       def update_ops_fn(running_averages_variable, structure_memoizer,
#                         value_memoizer):
#       def average_denominator_weight_fn(running_averages_variable):
#   def evaluate(self, structure_memoizer):
#       def ratio_fn(numerator_value, denominator_value):
#   def is_differentiable(self):
#   def key(self):
#   def __mul__(self, scalar):
#   def __rmul__(self, scalar):
#   def __truediv__(self, scalar):
#   def __neg__(self):
#   def __add__(self, other):
#   def __sub__(self, other):
#   def evaluate(self, structure_memoizer):
#   def __init__(self, tensor):
#   def tensor(self):
#   def is_differentiable(self):
#   def key(self):
#   def __mul__(self, scalar):
#   def __truediv__(self, scalar):
#   def __neg__(self):
#   def __add__(self, other):
#   def __sub__(self, other):
#   def evaluate(self, structure_memoizer):
#   def __init__(self, predictions, ratio_weights, loss):
#   def ratio(cls, positive_coefficient, negative_coefficient, predictions,
#             weights, numerator_predicate, denominator_predicate, loss):
#   def predictions(self):
#   def ratio_weights(self):
#   def loss(self):
#   def is_differentiable(self):
#   def key(self):
#   def __mul__(self, scalar):
#   def __truediv__(self, scalar):
#   def __neg__(self):
#   def __add__(self, other):
#   def __sub__(self, other):
#   def evaluate(self, structure_memoizer):
#     def average_loss_fn(predictions_value, ratio_weights_value):
#   def __init__(self, predictions, ratio_weights, loss):
#   def ratio(cls, coefficients, predictions, weights, numerator_predicate,
#             denominator_predicate, loss):
#   def predictions(self):
#   def ratio_weights(self):
#   def loss(self):
#   def is_differentiable(self):
#   def key(self):
#   def __mul__(self, scalar):
#   def __truediv__(self, scalar):
#   def __neg__(self):
#   def __add__(self, other):
#   def __sub__(self, other):
#   def evaluate(self, structure_memoizer):
#     def average_loss_fn(predictions_value, ratio_weights_value):


import abc
import numbers
import six
from tensorflow_constrained_optimization.python.rates import basic_expression
from tensorflow_constrained_optimization.python.rates import constraint
from tensorflow_constrained_optimization.python.rates import helpers
from tensorflow_constrained_optimization.python.rates import term
    `Expression` that do some extra processing before being evaluated.

    Args:
      expressions: collection of `Expression`s that this object should sum.
    """
    super(SumExpression, self).__init__()
    self._expressions = []
    for subexpression in expressions:
      self._expressions += SumExpression._expression_to_list(subexpression)

  @property
  def penalty_expression(self):
    # Notice that this summation will perform some simplification, since
    # BasicExpressions combine compatible Terms when added.
    result = basic_expression.BasicExpression([])
    for subexpression in self._expressions:
      result += subexpression.penalty_expression
    return result

  @property
  def constraint_expression(self):
    # Notice that this summation will perform some simplification, since
    # BasicExpressions combine compatible Terms when added.
    result = basic_expression.BasicExpression([])
    for subexpression in self._expressions:
      result += subexpression.constraint_expression
    return result

  @property
  def extra_constraints(self):

# Path: tensorflow_constrained_optimization/python/rates/basic_expression.py
# class BasicExpression(helpers.RateObject):
#   def _add_terms(self, source):
#   def _sub_terms(self, source):
#   def __init__(self, terms):
#   def is_differentiable(self):
#   def __mul__(self, scalar):
#   def __rmul__(self, scalar):
#   def __truediv__(self, scalar):
#   def __neg__(self):
#   def __add__(self, other):
#   def __sub__(self, other):
#   def evaluate(self, structure_memoizer):
# 
# 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/helpers.py
# class RateObject(object):
# class UniqueList(RateObject):
# def convert_to_1d_tensor(tensor, name=None):
# def get_num_columns_of_2d_tensor(tensor, name="tensor"):
# def get_num_elements_of_tensor(tensor, name="tensor"):
#   def __init__(self, collection=None, element_type=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):
# 
# Path: tensorflow_constrained_optimization/python/rates/term.py
# class _RatioWeights(helpers.RateObject):
# class Term(helpers.RateObject):
# class TensorTerm(Term):
# class BinaryClassificationTerm(Term):
# class MulticlassTerm(Term):
#   def __init__(self, ratios, num_columns):
#   def ratios(self):
#   def num_columns(self):
#   def ratio(cls, weights, column_coefficients, numerator_predicate,
#             denominator_predicate):
#     def value_fn(weights_value, predicate_value):
#   def __mul__(self, scalar):
#   def __rmul__(self, scalar):
#   def __truediv__(self, scalar):
#   def __neg__(self):
#   def __add__(self, other):
#   def __sub__(self, other):
#   def _evaluate_denominator(self, denominator, structure_memoizer):
#       def update_ops_fn(running_averages_variable, structure_memoizer,
#                         value_memoizer):
#       def average_denominator_weight_fn(running_averages_variable):
#   def evaluate(self, structure_memoizer):
#       def ratio_fn(numerator_value, denominator_value):
#   def is_differentiable(self):
#   def key(self):
#   def __mul__(self, scalar):
#   def __rmul__(self, scalar):
#   def __truediv__(self, scalar):
#   def __neg__(self):
#   def __add__(self, other):
#   def __sub__(self, other):
#   def evaluate(self, structure_memoizer):
#   def __init__(self, tensor):
#   def tensor(self):
#   def is_differentiable(self):
#   def key(self):
#   def __mul__(self, scalar):
#   def __truediv__(self, scalar):
#   def __neg__(self):
#   def __add__(self, other):
#   def __sub__(self, other):
#   def evaluate(self, structure_memoizer):
#   def __init__(self, predictions, ratio_weights, loss):
#   def ratio(cls, positive_coefficient, negative_coefficient, predictions,
#             weights, numerator_predicate, denominator_predicate, loss):
#   def predictions(self):
#   def ratio_weights(self):
#   def loss(self):
#   def is_differentiable(self):
#   def key(self):
#   def __mul__(self, scalar):
#   def __truediv__(self, scalar):
#   def __neg__(self):
#   def __add__(self, other):
#   def __sub__(self, other):
#   def evaluate(self, structure_memoizer):
#     def average_loss_fn(predictions_value, ratio_weights_value):
#   def __init__(self, predictions, ratio_weights, loss):
#   def ratio(cls, coefficients, predictions, weights, numerator_predicate,
#             denominator_predicate, loss):
#   def predictions(self):
#   def ratio_weights(self):
#   def loss(self):
#   def is_differentiable(self):
#   def key(self):
#   def __mul__(self, scalar):
#   def __truediv__(self, scalar):
#   def __neg__(self):
#   def __add__(self, other):
#   def __sub__(self, other):
#   def evaluate(self, structure_memoizer):
#     def average_loss_fn(predictions_value, ratio_weights_value):


# Path: tensorflow_constrained_optimization/python/rates/expression.py
import abc
import numbers
import six
from tensorflow_constrained_optimization.python.rates import basic_expression
from tensorflow_constrained_optimization.python.rates import constraint
from tensorflow_constrained_optimization.python.rates import helpers
from tensorflow_constrained_optimization.python.rates import term

    `Expression` that do some extra processing before being evaluated.

    Args:
      expressions: collection of `Expression`s that this object should sum.
    """
    super(SumExpression, self).__init__()
    self._expressions = []
    for subexpression in expressions:
      self._expressions += SumExpression._expression_to_list(subexpression)

  @property
  def penalty_expression(self):
    # Notice that this summation will perform some simplification, since
    # BasicExpressions combine compatible Terms when added.
    result = basic_expression.BasicExpression([])
    for subexpression in self._expressions:
      result += subexpression.penalty_expression
    return result

  @property
  def constraint_expression(self):
    # Notice that this summation will perform some simplification, since
    # BasicExpressions combine compatible Terms when added.
    result = basic_expression.BasicExpression([])
    for subexpression in self._expressions:
      result += subexpression.constraint_expression
    return result

  @property
  def extra_constraints(self):

    result = constraint.ConstraintList()