def get_output_size(height, width, filter_height, filter_width, padding, stride):
    """
    return (output_height, output_width)

    You can see below by drawing a figure.
    height + 2 * padding = filter_height + (output_height - 1) * stride
    width + 2 * padding = filter_width + (output_width - 1) * stride

    height: height of input
    width: width of input
    filter_height: height of filter
    filter_width: width of filter
    padding: width to expand the edge of input
    stride: Width to slide filter
    """
    output_height = 1 + (height + 2 * padding - filter_height) / stride
    output_width = 1 + (width + 2 * padding - filter_width) / stride

    if output_height != int(output_height):
        raise ValueError(
            'output_height({0}) must be integer.'.format(output_height))
    if output_width != int(output_width):
        raise ValueError(
            'output_width({0}) must be integer.'.format(output_width))

    return int(output_height), int(output_width)