human
What is a Python program to compare layer by layer of a caffe network with mxnet network given the following:
Complete the below
def compare_layers_from_nets(caffe_net, arg_params, aux_params, exe, layer_name_to_record, top_to_layers, mean_diff_allowed, max_diff_allowed):

    ''''Compare layer by layer of a caffe network with mxnet network
    :param caffe_net: loaded caffe network
    :param arg_params: arguments
    :param aux_params: auxiliary parameters
    :param exe: mxnet model
    :param layer_name_to_record: map between caffe layer and information record
    :param top_to_layers: map between caffe blob name to layers which outputs it (including inplace)
    :param mean_diff_allowed: mean difference allowed between caffe blob and mxnet blob
    :param max_diff_allowed: max difference allowed between caffe blob and mxnet blob'
    '''
assistant
#Here is Python program to compare layer by layer of a caffe network with mxnet network
.
    import re
    log_format = '        {0:<40}        {1:<40}        {2:<8}        {3:>10}        {4:>10}        {5:<1}'
    compare_layers_from_nets.is_first_convolution = True
    def _compare_blob(caf_blob, mx_blob, caf_name, mx_name, blob_type, note):
        diff = np.abs((mx_blob - caf_blob))
        diff_mean = diff.mean()
        diff_max = diff.max()
        logging.info(log_format.format(caf_name, mx_name, blob_type, ('%4.5f' % diff_mean), ('%4.5f' % diff_max), note))
        assert (diff_mean < mean_diff_allowed)
        assert (diff_max < max_diff_allowed)
    def _process_layer_parameters(layer):
        logging.debug('processing    layer    %s    of    type    %s', layer.name, layer.type)
        normalized_layer_name = re.sub('[-/]', '_', layer.name)
        if ((layer.name in caffe_net.params) and (layer.type in ['Convolution', 'InnerProduct', 'Deconvolution'])):
            has_bias = (len(caffe_net.params[layer.name]) > 1)
            mx_name_weight = '{}_weight'.format(normalized_layer_name)
            mx_beta = arg_params[mx_name_weight].asnumpy()
            if ((layer.type == 'Convolution') and compare_layers_from_nets.is_first_convolution):
                compare_layers_from_nets.is_first_convolution = False
                if ((mx_beta.shape[1] == 3) or (mx_beta.shape[1] == 4)):
                    mx_beta[:, [0, 2], :, :] = mx_beta[:, [2, 0], :, :]
            caf_beta = caffe_net.params[layer.name][0].data
            _compare_blob(caf_beta, mx_beta, layer.name, mx_name_weight, 'weight', '')
            if has_bias:
                mx_name_bias = '{}_bias'.format(normalized_layer_name)
                mx_gamma = arg_params[mx_name_bias].asnumpy()
                caf_gamma = caffe_net.params[layer.name][1].data
                _compare_blob(caf_gamma, mx_gamma, layer.name, mx_name_bias, 'bias', '')
        elif ((layer.name in caffe_net.params) and (layer.type == 'Scale')):
            if ('scale' in normalized_layer_name):
                bn_name =...