Convert an activation layer from keras to coreml.

    Parameters
    ----------
    keras_layer: layer
        A keras layer object.

    builder: NeuralNetworkBuilder
        A neural network builder object.

def convert_activation(builder, layer, input_names, output_names, keras_layer):
    """
    Convert an activation layer from keras to coreml.

    Parameters
    ----------
    keras_layer: layer
        A keras layer object.

    builder: NeuralNetworkBuilder
        A neural network builder object.
    """
    # Get input and output names
    input_name, output_name = (input_names[0], output_names[0])
    non_linearity = _get_activation_name_from_keras_layer(keras_layer)

    # Add a non-linearity layer
    if non_linearity == 'SOFTMAX':
        builder.add_softmax(name = layer, input_name = input_name,
                output_name = output_name)
        return
    if non_linearity == 'RELU6':
        # No direct support of RELU with max-activation value - use negate and
        # clip layers
        relu_output_name = output_name + '_relu'
        builder.add_activation(layer, 'RELU', input_name, relu_output_name)
        # negate it
        neg_output_name = relu_output_name + '_neg'
        builder.add_activation(layer+'__neg__', 'LINEAR', relu_output_name,
                neg_output_name,[-1.0, 0])
        # apply threshold
        clip_output_name = relu_output_name + '_clip'
        builder.add_unary(layer+'__clip__', neg_output_name, clip_output_name,
                'threshold', alpha = -6.0)
        # negate it back
        builder.add_activation(layer+'_neg2', 'LINEAR', clip_output_name,
                output_name,[-1.0, 0])
        return

    if non_linearity == 'SELU':
        elu_output_name = output_name + '_elu'
        builder.add_activation(layer+'__elu__', 'ELU', input_name, elu_output_name,
                             params=1.6732)
        builder.add_elementwise(layer,
                          input_names=elu_output_name,
                          output_name=output_name,
                          mode='MULTIPLY',
                          alpha=1.0507)
        return

    params = None
    if non_linearity == 'UNIT_ELU':
        params = 1.0
        non_linearity = 'ELU'
    elif non_linearity == 'LEAKYRELU':
        params = [keras_layer.alpha]
    elif non_linearity == 'PRELU':
        shared_axes = list(keras_layer.shared_axes)
        if not (shared_axes == [1,2,3] or shared_axes == [1,2]):
            _utils.raise_error_unsupported_scenario(
                    "Shared axis not being [1,2,3] or [1,2]",
                    'parametric_relu', layer)
        params = _keras.backend.eval(keras_layer.weights[0])
    elif non_linearity == 'ELU':
        params = keras_layer.alpha
    elif non_linearity == 'THRESHOLDEDRELU':
        params = keras_layer.theta
    else:
        pass # do nothing to parameters

    builder.add_activation(name = layer,
            non_linearity = non_linearity,
            input_name = input_name, output_name = output_name,
            params = params)