m-toman:

the optimize_for_mobile version runs 5 seconds for a given task while the unoptimized one runs for 4 seconds.


Without knowing the details of the model it might be a bit harder. Are you profiling only one call to forward or multiple?