21tf 练习到第六章,发现1060的6G不够了

打印:2020-01-09 22:36:08.018462: E tensorflow/stream_executor/cuda/cuda_driver.cc:806] failed to allocate 5.93G (6370295808 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY: out of memory

图像太吃内存,换到其它章节看看。

One thought on “21tf 练习到第六章,发现1060的6G不够了”

  1. 解决方法 for tf 1.x版本:
    import tensorflow as tf
    import os
    os.environ[“CUDA_VISIBLE_DEVICES”] = ‘0’ #指定第一块GPU可用
    config = tf.ConfigProto()
    config.gpu_options.per_process_gpu_memory_fraction = 0.5 # 程序最多只能占用指定gpu50%的显存
    config.gpu_options.allow_growth = True #程序按需申请内存
    sess = tf.Session(config = config)

Leave a Reply

Your email address will not be published. Required fields are marked *