zoukankan      html  css  js  c++  java
  • 安装keras+tf

    1.查看keras和tf的对应版本

    https://docs.floydhub.com/guides/environments/

    2.keras如何使用GPU?

    https://blog.csdn.net/qq_33182424/article/details/106080243 

    检查GPU:

    from tensorflow.python.client import device_lib
    print(device_lib.list_local_devices())

     检查是否可利用GPU:

    from keras import backend as K
    K.tensorflow_backend._get_available_gpus()

    3.判断tf是否可以使用GPU?

    https://blog.csdn.net/xiaozisheng2008_/article/details/80558914

    import os
    import tensorflow as tf
    import numpy as np
    
    hello=tf.constant('hhh')
    sess=tf.Session()
    print (sess.run(hello))

    出现上面这样的就说明可以用了。

    然后安装对应版本的keras,之后再使用keras,有如下代码

    import os
    os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
    
    os.environ["CUDA_VISIBLE_DEVICES"]="0"

    就可以使用gpu了。

    4.安装keras-contrib

    https://blog.csdn.net/qq_31456593/article/details/89388107

    pip install git+https://www.github.com/keras-team/keras-contrib.git
  • 相关阅读:
    3.04
    3.03
    3.02
    3.01
    2.27
    2.25小账本6
    2.24小账本5
    2.23小账本4
    2.22小账本3
    git常用命令
  • 原文地址:https://www.cnblogs.com/BlueBlueSea/p/13682301.html
Copyright © 2011-2022 走看看