zoukankan      html  css  js  c++  java
  • 禁用GPU版本TensorFlow,切换到CPU版本TensorFlow。

    #禁用gpu版本TensorFlow,因为CUDA号码从0开始,这里直接让CUDA使用-1的GPU,自然就无法使用gpu了。

    代码前面加入:

    import os
    os.environ["CUDA_VISIBLE_DEVICES"]="-1"    
    import tensorflow as tf
    Environment Variable Syntax    Results
    CUDA_VISIBLE_DEVICES=1    Only device 1 will be seen
    CUDA_VISIBLE_DEVICES=0,1    Devices 0 and 1 will be visible
    CUDA_VISIBLE_DEVICES="0,1"    Same as above, quotation marks are optional
    CUDA_VISIBLE_DEVICES=0,2,3    Devices 0, 2, 3 will be visible; device 1 is masked

    如果安装了GPU,默认使用GPU版本的TensorFlow
    ---------------------
    作者:湾区人工智能
    来源:CSDN
    原文:https://blog.csdn.net/BTUJACK/article/details/82622966
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    freak out用法
    kinda用法
    比较级与最高级
    issue用法
    invite用法
    yet用法
    follow用法
    get用法
    turn up&turn off&turn on用法
    关于document.lastModified属性
  • 原文地址:https://www.cnblogs.com/jfdwd/p/11225748.html
Copyright © 2011-2022 走看看