# 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
#
#     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.
# ==============================================================================
"""OpRegularizers that concatenate and slice other OpRegularizers.

When we have a concatenation op in the network, which concatenates several
tensors, the regularizers of the concatenated ops (that is, the
regularization_vector and the alive_vector) should be concatenated as well.

Slicing is the complementary op - if regularizers Ra and Rb were concatenated
into a regularizer Rc, Ra and Rb can be obtained from Rc by slicing.
"""

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



class ConcatRegularizer(generic_regularizers.OpRegularizer):
  """An OpRegularizer that concatenates others, to reflect a Concat op."""

  def __init__(self, regularizers_to_concatenate):
    for r in regularizers_to_concatenate:

# 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/concat_and_slice_regularizers.py
from morph_net.framework import generic_regularizers
import tensorflow.compat.v1 as tf

#
#     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.
# ==============================================================================
"""OpRegularizers that concatenate and slice other OpRegularizers.

When we have a concatenation op in the network, which concatenates several
tensors, the regularizers of the concatenated ops (that is, the
regularization_vector and the alive_vector) should be concatenated as well.

Slicing is the complementary op - if regularizers Ra and Rb were concatenated
into a regularizer Rc, Ra and Rb can be obtained from Rc by slicing.
"""

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



class ConcatRegularizer(generic_regularizers.OpRegularizer):
  """An OpRegularizer that concatenates others, to reflect a Concat op."""

  def __init__(self, regularizers_to_concatenate):
    for r in regularizers_to_concatenate:

      if not generic_regularizers.dimensions_are_compatible(r):