TensorFlow 2.0 佔用 GPU 問題

TensorFlow 預設會佔滿所有可用記憶體,載入模型前輸入可解決

import tensorflow as tf 
import os
os.environ['CUDA_VISIBLE_DEVICES']="0"
config=tf.compat.v1.ConfigProto() 
config.gpu_options.visible_device_list = '0' 
config.gpu_options.allow_growth = True 
sess=tf.compat.v1.Session(config=config)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *