||
add the following codes to allocate a GPU to your codes:
>>>import tensorflow as tf
>>>from keras.backend.tensorflow_backend import set_session
>>>np.set_printoptions(suppress=True)
>>>os.environ["CUDA_VISIBLE_DEVICES"]="0"
>>>config = tf.ConfigProto()
>>>config.gpu_options.per_process_gpu_memory_fraction = 0.95
>>>set_session(tf.Session(config=config))
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-7-26 22:25
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社