torch.set_num_threads torch.set_num_threads(int) Sets the number of threads used for intraop parallelism on CPU.