Convert a batchnorm layer from mxnet to coreml.

    Parameters
    ----------
    network: net
        A mxnet network object.

    layer: node
        Node to convert.

    module: module
        An module for MXNet

    builder: NeuralNetworkBuilder
        A neural network builder object.

def convert_batchnorm(net, node, module, builder):
    """Convert a batchnorm layer from mxnet to coreml.

    Parameters
    ----------
    network: net
        A mxnet network object.

    layer: node
        Node to convert.

    module: module
        An module for MXNet

    builder: NeuralNetworkBuilder
        A neural network builder object.
    """
    input_name, output_name = _get_input_output_name(net, node)
    name = node['name']
    inputs = node['inputs']


    eps = 1e-3  # Default value of eps for MXNet.
    use_global_stats = False  # Default value of use_global_stats for MXNet.
    fix_gamma = True  # Default value of fix_gamma for MXNet.
    attrs = _get_attrs(node)
    if 'eps' in attrs:
        eps = literal_eval(attrs['eps'])
    if 'fix_gamma' in attrs:
        fix_gamma = literal_eval(attrs['fix_gamma'])

    args, aux = module.get_params()
    gamma = args[_get_node_name(net, inputs[1][0])].asnumpy()
    beta = args[_get_node_name(net, inputs[2][0])].asnumpy()
    mean = aux[_get_node_name(net, inputs[3][0])].asnumpy()
    variance = aux[_get_node_name(net, inputs[4][0])].asnumpy()
    nb_channels = gamma.shape[0]
    if fix_gamma:
        gamma.fill(1.)
    builder.add_batchnorm(
        name=name,
        channels=nb_channels,
        gamma=gamma,
        beta=beta,
        mean=mean,
        variance=variance,
        input_name=input_name,
        output_name=output_name,
        epsilon=eps)