How do you set the number of threads to 1 in python? Did anyone solve this problem and force PyTorch to use only 1 threads?
The following setting make the number of threads to 1 but as soon as I use an object detection model in torch, the number of threads reaches to 8.
os.environ[“OMP_NUM_THREADS”] = “1”
os.environ[“MKL_NUM_THREADS”] = “1”
torch.set_num_threads(1)
torch.set_num_interop_threads(1)
os.system(“top -H -b -n1 | grep project | wc -l”)