def randomize_weights(mlmodel: "_ct.models.MLModel"):
    """
    Utility function to randomize weights

    Parameters
    ----------
    mlmodel: MLModel
        Model which will be randomized.

    Returns
    -------
    model: MLModel
        The MLModel with randomized weights.

    Examples
    --------
    .. sourcecode:: python

        import coremltools as ct

        model = ct.models.MLModel("my_model.mlpackage")
        randomized_mlmodel = ct.models.utils.randomize_weights(mlmodel)

    """

    randomized_mlmodel = _apply_graph_pass(
        mlmodel, graph_pass=_WeightRandomizer(), skip_model_load=True
    )

    return randomized_mlmodel

    Utility function to randomize weights

    Parameters
    ----------
    mlmodel: MLModel
        Model which will be randomized.

    Returns
    -------
    model: MLModel
        The MLModel with randomized weights.

    Examples
    --------
    .. sourcecode:: python

        import coremltools as ct

        model = ct.models.MLModel("my_model.mlpackage")
        randomized_mlmodel = ct.models.utils.randomize_weights(mlmodel)

    
coremltools/models/utils.py