美文网首页
failed to allocate **M (** bytes

failed to allocate **M (** bytes

作者: 水球喵 | 来源:发表于2018-07-10 15:55 被阅读0次

    错误原因:GPU资源占用太大

    config = tf.ConfigProto(allow_soft_placement=True)
    gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.7)
    config.gpu_options.allow_growth = True

    找到如下红的的这句话,在这之前加上如上三行代码,在session前约束占用空间。能够使得tensorflow占用资源降至70%,当然也可以改为50%,而不是整个服务器GPU

    with tf.Session() as sess:
    将其改为
    with tf.Session(config=config) as sess:

    最终改为如下结构就可以啦

    config = tf.ConfigProto(allow_soft_placement=True)
    gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.7)
    config.gpu_options.allow_growth = True
    with tf.Session(config=config) as sess:

    相关文章

      网友评论

          本文标题:failed to allocate **M (** bytes

          本文链接:https://www.haomeiwen.com/subject/dttqpftx.html