def get_kernel(x, kernel):
    """
    Calculates the kernel size given the input. Kernel size is changed only if the input dimentions are smaller
    than kernel

    Args:
      x: The input vector.
      kernel:  The height and width of the convolution kernel filter

    Returns:
      The height and width of new convolution kernel filter
    """
    height = kernel[0]
    width = kernel[1]
    if x.get_shape().as_list()[1] < height:
        height = x.get_shape().as_list()[1]
    elif x.get_shape().as_list()[2] < width:
        width = x.get_shape().as_list()[2]

    return (height, width)