显存充足,但是却出现CUDA error:out of memory错误
添加:
import os
# 设置程序使用的GPU编号:我用6号和7号显卡
os.environ['CUDA_VISIBLE_DEVICES'] = '0,1'
import numpy as np
import keras
import keras.backend as K
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import keras.backend as K
gpu_options = tf.compat.v1.GPUOptions(per_process_gpu_memory_fraction=0.99)
gpu_options.allow_growth = True
sess = tf.compat.v1.Session(config=tf.compat.v1.ConfigProto(gpu_options=gpu_options))