# Path: morph_net/framework/generic_regularizers.py
# class NetworkRegularizer(object):  # pytype: disable=ignored-metaclass
# class OpRegularizer(object):  # pytype: disable=ignored-metaclass
#   def get_regularization_term(self, ops=None):
#   def get_cost(self, ops=None):
#   def op_regularizer_manager(self):
#   def name(self):
#   def cost_name(self):
#   def regularization_vector(self):
#   def alive_vector(self):
# def dimensions_are_compatible(op_regularizer):


from morph_net.framework import generic_regularizers
import tensorflow.compat.v1 as tf
      regularizers_to_group: A list of generic_regularizers.OpRegularizer
        objects.Their regularization_vector (alive_vector) are expected to be of
        the same length.

    Raises:
      ValueError: regularizers_to_group is not of length at least 2.
    """
    if len(regularizers_to_group) < 2:
      raise ValueError('Groups must be of at least size 2.')

    first = regularizers_to_group[0]
    regularization_vector = first.regularization_vector
    alive_vector = first.alive_vector
    for index in range(1, len(regularizers_to_group)):
      regularizer = regularizers_to_group[index]
      regularization_vector = tf.maximum(regularization_vector,
                                         regularizer.regularization_vector)
      alive_vector = tf.logical_or(alive_vector, regularizer.alive_vector)
    self._regularization_vector = regularization_vector
    self._alive_vector = alive_vector

  @property
  def regularization_vector(self):
    return self._regularization_vector

  @property
  def alive_vector(self):
    return self._alive_vector



# Path: morph_net/framework/generic_regularizers.py
# class NetworkRegularizer(object):  # pytype: disable=ignored-metaclass
# class OpRegularizer(object):  # pytype: disable=ignored-metaclass
#   def get_regularization_term(self, ops=None):
#   def get_cost(self, ops=None):
#   def op_regularizer_manager(self):
#   def name(self):
#   def cost_name(self):
#   def regularization_vector(self):
#   def alive_vector(self):
# def dimensions_are_compatible(op_regularizer):


# Path: morph_net/framework/grouping_regularizers.py
from morph_net.framework import generic_regularizers
import tensorflow.compat.v1 as tf

      regularizers_to_group: A list of generic_regularizers.OpRegularizer
        objects.Their regularization_vector (alive_vector) are expected to be of
        the same length.

    Raises:
      ValueError: regularizers_to_group is not of length at least 2.
    """
    if len(regularizers_to_group) < 2:
      raise ValueError('Groups must be of at least size 2.')

    first = regularizers_to_group[0]
    regularization_vector = first.regularization_vector
    alive_vector = first.alive_vector
    for index in range(1, len(regularizers_to_group)):
      regularizer = regularizers_to_group[index]
      regularization_vector = tf.maximum(regularization_vector,
                                         regularizer.regularization_vector)
      alive_vector = tf.logical_or(alive_vector, regularizer.alive_vector)
    self._regularization_vector = regularization_vector
    self._alive_vector = alive_vector

  @property
  def regularization_vector(self):
    return self._regularization_vector

  @property
  def alive_vector(self):
    return self._alive_vector



class L2GroupingRegularizer(generic_regularizers.OpRegularizer):