其他分享
首页 > 其他分享> > failed to allocate 2.00G (2147483648 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY: out of memory

failed to allocate 2.00G (2147483648 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY: out of memory

作者:互联网

显存充足,但是却出现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))

标签:compat,memory,bytes,gpu,v1,MEMORY,tf,import,options
来源: https://blog.csdn.net/hanshuning/article/details/123215958