tensorflow
限制gpu:
1
2
3
4
5
6
7
8
9
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.3
# 动态增长
# config.gpu_options.allow_growth = True
set_session(tf.Session(config=config))