# Path: morph_net/framework/op_handler_util.py
# OP_TYPES_WITH_MULTIPLE_OUTPUTS = ('SplitV',)
# WEIGHTS_INDEX_DICT = {
#     'Conv2D': 1,
#     'Conv2DBackpropInput': 1,
#     'DepthwiseConv2dNative': 1,
#     'MatMul': 1
# }
# def get_input_ops(op, op_reg_manager, whitelist_indices=None):
#   def is_const(tensor):
#   def is_weight_tensor(i, op_type):
# def get_output_ops(op, op_reg_manager):
# def get_ops_without_groups(ops, op_reg_manager):
# def remove_non_passthrough_ops(ops, op_reg_manager):
# def group_op_with_inputs_and_outputs(op, input_op_slices, output_op_slices,
#                                      aligned_op_slice_sizes, op_reg_manager):
# def get_concat_input_op_slices(concat_ops, op_reg_manager):
# def get_op_slices(ops, op_reg_manager):
# def get_op_slice_sizes(op_slices):
# def get_aligned_op_slice_sizes(op_slices, input_op_slices, output_op_slices):
# def get_aligned_sizes(op_slice_sizes):
# def _get_num_slices(op_slice_sizes):
# def reslice_concat_ops(concat_ops, aligned_op_slice_sizes, op_reg_manager):
# def get_total_slice_size(op_slice_sizes, index, slice_count):
# def reslice_ops(ops, aligned_op_slice_sizes, op_reg_manager):
# def _get_source_op_slices(op_slices, op_reg_manager):
# def group_aligned_input_output_slices(
#     op, input_ops_to_process, output_ops_to_process, input_op_slices,
#     output_op_slices, aligned_op_slice_sizes, op_reg_manager):
# def get_op_size(op):
# def separate_same_size_ops(reference_op, ops):
# def group_match(regex, op_slices):
# 
# Path: morph_net/framework/op_regularizer_manager.py
# ITERATION_LIMIT = 1000000
# class OpSlice(collections.namedtuple('OpSlice', ['op', 'slice'])):
# class Slice(collections.namedtuple('Slice', ['start_index', 'size'])):
# class OpRegularizerManager(object):
# class OpGroup(object):
#   def __str__(self):
#   def __str__(self):
#   def __init__(
#       self,
#       output_boundary: List[tf.Operation],
#       op_handler_dict=None,
#       create_grouping_regularizer=grouping_regularizers.MaxGroupingRegularizer,
#       force_group=None,
#       regularizer_blacklist=None,
#       input_boundary: List[tf.Operation] = None,
#       iteration_limit=ITERATION_LIMIT):
#   def ops(self):
#   def get_regularizer(self, op):
#   def create_op_group_for_op_slice(self, op_slice, is_source=True):
#   def group_op_slices(self, op_slices, omit_source_op_slices=None):
#   def slice_op(self, op, sizes):
#   def process_ops(self, ops):
#   def process_ops_last(self, ops):
#   def is_source_op(self, op):
#   def is_passthrough(self, op):
#   def get_op_slices(self, op):
#   def get_op_group(self, op_slice):
#   def _slice_op_slice(self, op_slice, sizes, size_index, size_count,
#                       new_op_slice_group):
#   def _slice_op_with_sizes(self, op, sizes, is_source, is_resliced):
#   def _get_source_slices(self, sizes, op_slices):
#   def _dfs_for_source_ops(self, output_boundary, input_boundary=None):
#   def _force_group_ops(self, force_group):
#   def __init__(self, op_slice=None, op_groups=None, omit_source_op_slices=None):
#   def op_slices(self):
#   def source_op_slices(self):


import mock
import tensorflow.compat.v1 as tf
from morph_net.framework import op_handler_util
from morph_net.framework import op_regularizer_manager as orm
from tensorflow.contrib import framework
from tensorflow.contrib import layers
    layers.batch_norm(net)

    g = tf.get_default_graph()

    # Declare OpSlice and OpGroup for ops in the first test network.
    self.batch_norm_op = g.get_operation_by_name(
        'conv1/BatchNorm/FusedBatchNormV3')
    self.batch_norm_op_slice = orm.OpSlice(self.batch_norm_op, None)
    self.batch_norm_op_group = orm.OpGroup(self.batch_norm_op_slice)

    self.conv_op = g.get_operation_by_name('conv1/Conv2D')
    self.conv_op_slice = orm.OpSlice(self.conv_op, None)
    self.conv_op_group = orm.OpGroup(
        self.conv_op_slice, omit_source_op_slices=[self.conv_op_slice])

    self.gamma_op = g.get_operation_by_name('conv1/BatchNorm/gamma/read')
    self.beta_op = g.get_operation_by_name('conv1/BatchNorm/beta/read')

    self.relu_op = g.get_operation_by_name('conv1/Relu')
    self.relu_op_slice = orm.OpSlice(self.relu_op, None)
    self.relu_op_group = orm.OpGroup(
        self.relu_op_slice, omit_source_op_slices=[self.relu_op_slice])

    # Declare OpSlice and OpGroup for ops in the second test network.
    self.relu2_op = g.get_operation_by_name('conv2/Relu')
    self.relu2_op_slice = orm.OpSlice(self.relu2_op, orm.Slice(0, 5))
    self.relu2_op_group = orm.OpGroup(
        self.relu2_op_slice, omit_source_op_slices=[self.relu2_op_slice])

    self.relu3_op = g.get_operation_by_name('conv3/Relu')

# Path: morph_net/framework/op_handler_util.py
# OP_TYPES_WITH_MULTIPLE_OUTPUTS = ('SplitV',)
# WEIGHTS_INDEX_DICT = {
#     'Conv2D': 1,
#     'Conv2DBackpropInput': 1,
#     'DepthwiseConv2dNative': 1,
#     'MatMul': 1
# }
# def get_input_ops(op, op_reg_manager, whitelist_indices=None):
#   def is_const(tensor):
#   def is_weight_tensor(i, op_type):
# def get_output_ops(op, op_reg_manager):
# def get_ops_without_groups(ops, op_reg_manager):
# def remove_non_passthrough_ops(ops, op_reg_manager):
# def group_op_with_inputs_and_outputs(op, input_op_slices, output_op_slices,
#                                      aligned_op_slice_sizes, op_reg_manager):
# def get_concat_input_op_slices(concat_ops, op_reg_manager):
# def get_op_slices(ops, op_reg_manager):
# def get_op_slice_sizes(op_slices):
# def get_aligned_op_slice_sizes(op_slices, input_op_slices, output_op_slices):
# def get_aligned_sizes(op_slice_sizes):
# def _get_num_slices(op_slice_sizes):
# def reslice_concat_ops(concat_ops, aligned_op_slice_sizes, op_reg_manager):
# def get_total_slice_size(op_slice_sizes, index, slice_count):
# def reslice_ops(ops, aligned_op_slice_sizes, op_reg_manager):
# def _get_source_op_slices(op_slices, op_reg_manager):
# def group_aligned_input_output_slices(
#     op, input_ops_to_process, output_ops_to_process, input_op_slices,
#     output_op_slices, aligned_op_slice_sizes, op_reg_manager):
# def get_op_size(op):
# def separate_same_size_ops(reference_op, ops):
# def group_match(regex, op_slices):
# 
# Path: morph_net/framework/op_regularizer_manager.py
# ITERATION_LIMIT = 1000000
# class OpSlice(collections.namedtuple('OpSlice', ['op', 'slice'])):
# class Slice(collections.namedtuple('Slice', ['start_index', 'size'])):
# class OpRegularizerManager(object):
# class OpGroup(object):
#   def __str__(self):
#   def __str__(self):
#   def __init__(
#       self,
#       output_boundary: List[tf.Operation],
#       op_handler_dict=None,
#       create_grouping_regularizer=grouping_regularizers.MaxGroupingRegularizer,
#       force_group=None,
#       regularizer_blacklist=None,
#       input_boundary: List[tf.Operation] = None,
#       iteration_limit=ITERATION_LIMIT):
#   def ops(self):
#   def get_regularizer(self, op):
#   def create_op_group_for_op_slice(self, op_slice, is_source=True):
#   def group_op_slices(self, op_slices, omit_source_op_slices=None):
#   def slice_op(self, op, sizes):
#   def process_ops(self, ops):
#   def process_ops_last(self, ops):
#   def is_source_op(self, op):
#   def is_passthrough(self, op):
#   def get_op_slices(self, op):
#   def get_op_group(self, op_slice):
#   def _slice_op_slice(self, op_slice, sizes, size_index, size_count,
#                       new_op_slice_group):
#   def _slice_op_with_sizes(self, op, sizes, is_source, is_resliced):
#   def _get_source_slices(self, sizes, op_slices):
#   def _dfs_for_source_ops(self, output_boundary, input_boundary=None):
#   def _force_group_ops(self, force_group):
#   def __init__(self, op_slice=None, op_groups=None, omit_source_op_slices=None):
#   def op_slices(self):
#   def source_op_slices(self):


# Path: morph_net/framework/op_handler_util_test.py
import mock
import tensorflow.compat.v1 as tf
from morph_net.framework import op_handler_util
from morph_net.framework import op_regularizer_manager as orm
from tensorflow.contrib import framework
from tensorflow.contrib import layers

    layers.batch_norm(net)

    g = tf.get_default_graph()

    # Declare OpSlice and OpGroup for ops in the first test network.
    self.batch_norm_op = g.get_operation_by_name(
        'conv1/BatchNorm/FusedBatchNormV3')
    self.batch_norm_op_slice = orm.OpSlice(self.batch_norm_op, None)
    self.batch_norm_op_group = orm.OpGroup(self.batch_norm_op_slice)

    self.conv_op = g.get_operation_by_name('conv1/Conv2D')
    self.conv_op_slice = orm.OpSlice(self.conv_op, None)
    self.conv_op_group = orm.OpGroup(
        self.conv_op_slice, omit_source_op_slices=[self.conv_op_slice])

    self.gamma_op = g.get_operation_by_name('conv1/BatchNorm/gamma/read')
    self.beta_op = g.get_operation_by_name('conv1/BatchNorm/beta/read')

    self.relu_op = g.get_operation_by_name('conv1/Relu')
    self.relu_op_slice = orm.OpSlice(self.relu_op, None)
    self.relu_op_group = orm.OpGroup(
        self.relu_op_slice, omit_source_op_slices=[self.relu_op_slice])

    # Declare OpSlice and OpGroup for ops in the second test network.
    self.relu2_op = g.get_operation_by_name('conv2/Relu')
    self.relu2_op_slice = orm.OpSlice(self.relu2_op, orm.Slice(0, 5))
    self.relu2_op_group = orm.OpGroup(
        self.relu2_op_slice, omit_source_op_slices=[self.relu2_op_slice])

    self.relu3_op = g.get_operation_by_name('conv3/Relu')

    self.relu3_op_slice = orm.OpSlice(self.relu3_op, orm.Slice(0, 6))