【TensorFlow】安装与自测

  1. 安装TensorFlow

    conda install tensorflow-gpu
    
  2. 测试TensorFlow是否安装成功

    import tensorflow as tf 
    sess = tf.Session() 
    a = tf.constant(1) 
    b = tf.constant(2) 
    print(sess.run(a+b)) 
    

    tensorflow 1.0版本的代码要创建会话Session
    需要注意的是:tensorflow的代码默认会占用所有显卡的所有显存

  3. TensorFlow按需分配显存
    参考链接:tensorflow 使用 cpu 而不使用 gpu 问题 - 万道一 - 博客园 (cnblogs.com)

  4. [Update] Tensorflow安装
    https://tf.wiki/zh_hans/basic/installation.html

posted @ 2021-07-22 12:20  达可奈特  阅读(30)  评论(0编辑  收藏  举报