I have a laptop with 4 cores (4 CPUs I assume?). If I don’t set the number of threads (with torch.set_num_threads), the performance is really bad. I have two questions:

which number should I give to torch.set_num_threads? I don’t really understand what “number of threads” means. I have 4 cores, should I set it to 4 or to 1?
when should I set the number of threads? At the beginning of all my Pytorch programs?

Thank you in advance for your answers