# 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/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):


import abc
import copy
import operator
import numpy as np
import six
import tensorflow as tf
from six.moves import xrange  # pylint: disable=redefined-builtin
from tensorflow_constrained_optimization.python.rates import defaults
from tensorflow_constrained_optimization.python.rates import helpers
    if callable(self._input.value):
      result = None
      if value_memoizer is not None:
        key = (ExplicitDeferredTensor, self)
        if key not in value_memoizer:
          value_memoizer[key] = (self._input.value(), self._auto_cast)
        result = value_memoizer[key]
      else:
        result = (self._input.value(), self._auto_cast)
    else:
      del value_memoizer
      result = self._input.value, self._auto_cast

    return result

  @property
  def inputs(self):
    # The only input upon which this ExplicitDeferredTensor depends is its own.
    return [self._input.value]

  @property
  def variables(self):
    # ExplicitDeferredTensors are non-variable leaves, and therefore have no
    # dependencies on DeferredVariables.
    return []

  def __hash__(self):
    return hash((self._input, self._auto_cast))

  def __eq__(self, other):

# 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/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/deferred_tensor.py
import abc
import copy
import operator
import numpy as np
import six
import tensorflow as tf
from six.moves import xrange  # pylint: disable=redefined-builtin
from tensorflow_constrained_optimization.python.rates import defaults
from tensorflow_constrained_optimization.python.rates import helpers

    if callable(self._input.value):
      result = None
      if value_memoizer is not None:
        key = (ExplicitDeferredTensor, self)
        if key not in value_memoizer:
          value_memoizer[key] = (self._input.value(), self._auto_cast)
        result = value_memoizer[key]
      else:
        result = (self._input.value(), self._auto_cast)
    else:
      del value_memoizer
      result = self._input.value, self._auto_cast

    return result

  @property
  def inputs(self):
    # The only input upon which this ExplicitDeferredTensor depends is its own.
    return [self._input.value]

  @property
  def variables(self):
    # ExplicitDeferredTensors are non-variable leaves, and therefore have no
    # dependencies on DeferredVariables.
    return []

  def __hash__(self):
    return hash((self._input, self._auto_cast))

  def __eq__(self, other):

    if not isinstance(other, helpers.RateObject):