import math


def _conv_out_size(input_size, filter_size, stride,
                   padding="VALID"):
    """
    Computes the output size for a given input size after
    applying a 1D convolution with stride.

    Args:
        input_size : integer input size.
        filter_size : size of 1D filter.
        stride : step size between filter applications.
        padding : type of zero-padding used in the convolution.

    Returns:
        Integer output size.
    """
    if padding == "VALID":
        sizes = (input_size - filter_size + 1)
    elif padding == "SAME":
        sizes = input_size
    else:
        raise ValueError("Invalid padding: {}".format(padding))
    return int(math.ceil(sizes / stride))