def get_kernel_size(weights: _torch.nn.parameter.Parameter) -> _Tuple[int]:
    """
    Returns the kernel size of the input parameters given weights tensor.
    Assumes the first and second dimension correspond to channel dimensions.
    Assumes the remaining dimensions are spatial dimensions, which correspond
    to the kernel size.
    """

    num_spatial_dims = len(weights.shape) - 2
    assert num_spatial_dims >= 1, "Number of spatial dimensions should be at least 1"
    return tuple(weights.shape[2:])

    Returns the kernel size of the input parameters given weights tensor.
    Assumes the first and second dimension correspond to channel dimensions.
    Assumes the remaining dimensions are spatial dimensions, which correspond
    to the kernel size.
    
coremltools/optimize/torch/_utils/transforms.py