code: def simulate_quant_fn(ref_pipe, quantization_to_simulate):
      simulated_pipe = deepcopy(ref_pipe.to("cpu"))
      quantization_to_simulate(simulated_pipe.unet)
      simulated_out = run_pipe(simulated_pipe)
      del simulated_pipe
      gc.collect()
  
      ref_out = run_pipe(ref_pipe)
      simulated_psnr = sum(
          [
              float(f"{compute_psnr(r,t):.1f}")
              for r, t in zip(ref_out, simulated_out)
          ]
      ) / len(ref_out)
  
      return simulated_out, simulated_psnr
  
imports: from collections import OrderedDict
  from copy import deepcopy
  from functools import partial
  import argparse
  import gc
  import json
  import logging
  import numpy
  import os
  from PIL import Image
  from python_coreml_stable_diffusion.torch2coreml import compute_psnr, get_pipeline
  import time
  import torch
  import torch.nn
  import requests
  from tqdm import tqdm, trange
  from coremltools.converters.mil.mil import types
label_desc: Use image node_id 11 for calling a global function with example usage: simulate_quant_fn(ref_pipe, quantization_to_simulate) and returns: simulated_out,  simulated_psnr