Convert an instance norm layer from mxnet to coreml.

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

    node: layer
        Node to convert.

    model: model
        An model for MXNet

    builder: NeuralNetworkBuilder
        A neural network builder object.

def convert_instancenorm(net, node, model, builder):
    """Convert an instance norm layer from mxnet to coreml.

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

    node: layer
        Node to convert.

    model: model
        An model for MXNet

    builder: NeuralNetworkBuilder
        A neural network builder object.
    """
    import numpy as _np
    input_name, output_name = _get_input_output_name(net, node)

    name = node['name']
    inputs = node['inputs']
    outputs = node['outputs']


    data_blob_name = _get_node_name(net, inputs[0][0])
    gamma_blob_name = _get_node_name(net, inputs[1][0])
    beta_blob_name = _get_node_name(net, inputs[2][0])
    channels = _get_node_channels(net, inputs[0][0])

    bn_output_name = output_name + '_bn_'

    builder.add_batchnorm(
        name = name + '_normalize',
        channels = channels,
        gamma = _np.ones((channels, )),
        beta = _np.zeros((channels, )),
        mean = None,
        variance = None,
        input_name = input_name,
        output_name = bn_output_name,
        compute_mean_var = True,
        instance_normalization = True)

    gamma_input_names = [bn_output_name, gamma_blob_name]
    gamma_output_name = output_name + '_mult_gamma'
    builder.add_elementwise(name=name+'_mult_gamma', input_names=gamma_input_names,
        output_name = gamma_output_name, mode='MULTIPLY', alpha = None)
    beta_input_names = [gamma_output_name, beta_blob_name]
    builder.add_elementwise(name=name+'_add_beta', input_names=beta_input_names,
        output_name = output_name, mode='ADD', alpha=None)