How to set different threads number for different modules in TorchScript

I read this doc and found that torch.set_num_threads and torch.set_num_interop_threads can only be called before running script model.

Is there a way to control number of threads more flexibly in TorchScript that for a model’s different modules, we can set difference number of interop threads and introop threads to run?

Thanks for any answers!

No, there’s no option today for controlling parallelism on a module level

Got it, thank you for your answer!