def ios18_sparse_params_to_ios16(sparse_params: SparseParams) -> SparseParamsIos16:
    """The iOS16 sparse params pack mask into bytes, and need a `shape` parameter."""
    return SparseParamsIos16(
        nonzero_data=sparse_params.nonzero_data,
        mask=np.packbits(sparse_params.mask, bitorder="little"),
        shape=sparse_params.mask.shape,
    )
The iOS16 sparse params pack mask into bytes, and need a `shape` parameter.
coremltools/optimize/_utils.py