from math import floor


def conv_output_dim(input_size,
        kernel_size, stride=1, padding=0, dilation=1, **kwargs):
    """Calculate the output dimension of a convolutional layer
    """
    return floor((input_size + 2*padding - dilation*(kernel_size-1) - 1)/stride + 1)