def convert_convolution1d(builder, layer, input_names, output_names, keras_layer):
    """
    Convert convolution 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])

    has_bias = keras_layer.use_bias

    # Get the weights from _keras.
    # Keras stores convolution weights as list of numpy arrays
    weightList = keras_layer.get_weights()
    output_shape = list(filter(None, keras_layer.output_shape))[:-1]

    # Parameter
    filter_length, input_dim, n_filters = weightList[0].shape
    stride_width = keras_layer.strides if type(keras_layer.strides) is int \
            else keras_layer.strides[0]

    # Weights and bias terms
    W = _np.expand_dims(weightList[0],axis=0)
    b = weightList[1] if has_bias else None

    dilations = [1,1]
    if (type(keras_layer.dilation_rate) is list) or \
            (type(keras_layer.dilation_rate) is tuple):
        dilations = [1, keras_layer.dilation_rate[0]]
    else:
        dilations = [1, keras_layer.dilation_rate]

    keras_padding = keras_layer.padding
    if keras_padding == 'causal':
        builder.add_padding(name = layer + '__causal_pad__',
                left = filter_length-1, right=0, top=0, bottom=0, value= 0,
                input_name = input_name,
                output_name= input_name + '__causal_pad__')
        input_name = input_name + '__causal_pad__'
        keras_padding = 'valid'

    builder.add_convolution(name = layer,
             kernel_channels = input_dim,
             output_channels = n_filters,
             height = 1,
             width = filter_length,
             stride_height = 1,
             stride_width = stride_width,
             border_mode = keras_padding,
             groups = 1,
             W = W,
             b = b,
             has_bias = has_bias,
             is_deconv = False,
             output_shape = output_shape,
             input_name = input_name,
             output_name = output_name,
             dilation_factors = dilations)