def conv2d_output_size(kernel_size, stride, sidesize):
    """Calculate output size of Conv2D layer given kernel_size, stride, and size of one side of input image. Assumes square input image."""
    return (sidesize - (kernel_size - 1) - 1) // stride + 1