Convert convolution layer from keras to coreml.

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

    builder: NeuralNetworkBuilder
        A neural network builder object.

def convert_upsample(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.
    """
    _check_data_format(keras_layer)
    # Get input and output names
    input_name, output_name = (input_names[0], output_names[0])

    is_1d = isinstance(keras_layer, _keras.layers.UpSampling1D)

    # Currently, we only support upsample of same dims
    fh = fw = 1
    if is_1d:
        if type(keras_layer.size) is tuple and len(keras_layer.size) == 1:
            fh, fw = 1, keras_layer.size[0]
        elif type(keras_layer.size) is int:
            fh, fw = 1, keras_layer.size
        else:
            raise ValueError("Unrecognized upsample factor format %s" % (str(keras_layer.size)))
    else:
        if type(keras_layer.size) is int:
            fh = fw = keras_layer.size
        elif len(keras_layer.size) == 2:
            if keras_layer.size[0] != keras_layer.size[1]:
                raise ValueError("Upsample with different rows and columns not supported.")
            else:
                fh = keras_layer.size[0]
                fw = keras_layer.size[1]
        else:
            raise ValueError("Unrecognized upsample factor format %s" % (str(keras_layer.size)))

    builder.add_upsample(name = layer,
             scaling_factor_h = fh,
             scaling_factor_w = fw,
             input_name = input_name,
             output_name = output_name)