def apply_FRESCO_opt(
    pipe,
    steps=[],
    layers=[0, 1, 2, 3],
    flows=None,
    occs=None,
    correlation_matrix=[],
    intra_weight=1e2,
    iters=20,
    optimize_temporal=True,
    saliency=None,
):
    """
    Apply FRESCO-based optimization to a StableDiffusionPipeline
    """
    pipe.unet.forward = my_forward(
        pipe.unet, steps, layers, flows, occs, correlation_matrix, intra_weight, iters, optimize_temporal, saliency
    )

    Apply FRESCO-based optimization to a StableDiffusionPipeline
    
examples/community/fresco_v2v.py