美文网首页
tensorflow玩玩

tensorflow玩玩

作者: 蚂蚁爱吃饭 | 来源:发表于2021-11-16 11:32 被阅读0次

    安装:建议用conda安

    看自己的tensorflow是GPU还是CPU版:

    >>> from tensorflow.python.client import device_lib
    >>> print(device_lib.list_local_devices())
    [name: "/device:CPU:0"
    device_type: "CPU"
    memory_limit: 268435456
    locality {
    }
    incarnation: 14648057245001138740
    ]
    

    GPU版得服务器/电脑有显卡,需要安驱动。因为我这服务器的显卡不是伟英达。查看是啥显卡:

    yum install nvidia-detect
    nvidia-detect -v
    Probing for supported NVIDIA devices...
    [102b:0536] Matrox Electronics Systems Ltd. Integrated Matrox G200eW3 Graphics Controller
    No NVIDIA devices were found.
    

    所以这个啥玩意显卡?没找到驱动。CUBA只能是伟英达的才可以。所以放弃GPU的tensorflow!

    tensorflow2和1不兼容

    >>> hello = tf.constant('hello,tensorflow')
    >>> sess= tf.compat.v1.Session() #加上这句
    >>> print(sess.run(hello))
    b'hello,tensorflow'
    >>> print(sess.run(hello).decode()) #去掉前面的b
    hello,tensorflow
    

    相关文章

      网友评论

          本文标题:tensorflow玩玩

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