logo
Loading...

有沒有方法 只用CPU 的tensorflow - Cupoy

因為電腦沒有 GPU, 所以之前都是用CPU 版本的 tensorflow,但現在要 gpu_opt...

ml100-3,ml100-3-d76

有沒有方法 只用CPU 的tensorflow

2019/11/23 上午 10:36
機器學習共學討論版
William Mok
觀看數:30
回答數:2
收藏數:1
ml100-3
ml100-3-d76

因為電腦沒有 GPU, 所以之前都是用CPU 版本的 tensorflow,但現在要 

gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)


出現了

AttributeError: module 'tensorflow' has no attribute 'GPUOptions'


請問有沒有方法 只用CPU 的.

回答列表

  • 2019/11/23 上午 10:53
    Jeffrey
    贊同數:0
    不贊同數:0
    留言數:0

    請嘗試下列兩項:

    1. 需要把這行代碼註記 (remark)

    2. 移除 GPU 版本的 tensorflow, 安裝CPU 版本

  • 2019/11/24 下午 04:27
    陳凌虹
    贊同數:5
    不贊同數:1
    留言數:2

    試試這個

    import tensorflow as tf

    gpu_options = tf.compat.v1.GPUOptions(per_process_gpu_memory_fraction=0.333)

    sess = tf.compat.v1.Session(config=tf.compat.v1.ConfigProto(gpu_options=gpu_options))