我的系統有一個 GPU。
當我在上面運行 Tensorflow 時,TF 會自動檢測 GPU 并開始在 GPU 上運行執行緒。
我怎樣才能改變這個?
即如何在沒有 GPU 的情況下運行 Tensorflow?
uj5u.com熱心網友回復:
它應該作業。它主要是禁用 CUDA 設備。因此,代碼會尋找其他來源(CPU)來運行代碼。
import os
import tensorflow as tf
#os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" #If it doesn't work, uncomment this line; it should help.
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
#Your Code Here
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/368284.html
