3
を使用して:使用tensorflow.GPUOptions tensorflowバックエンド
tf.GPUOptions(per_process_gpu_memory_fraction=0.333,allow_growth=True)
tensorflowバックエンドとkerasで同じことをする方法はありますか?
を使用して:使用tensorflow.GPUOptions tensorflowバックエンド
tf.GPUOptions(per_process_gpu_memory_fraction=0.333,allow_growth=True)
tensorflowバックエンドとkerasで同じことをする方法はありますか?
あなたはkeras.backend.tensorflow_backend.set_session()
でKerasグローバルtensorflowセッションを設定することができます。
import tensorflow as tf
import keras.backend.tensorflow_backend as ktf
def get_session(gpu_fraction=0.333):
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=gpu_fraction,
allow_growth=True)
return tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))
ktf.set_session(get_session())