torch.set_num_threads¶ torch.set_num_threads(int)¶ 设置用于CPU上内部操作并行的线程数。 警告 为了确保使用正确的线程数量,必须在运行eager、JIT或autograd代码之前调用set_num_threads。