Tensorflow学习 day01

 安装tensorflow

Ubuntu 下  pycharm   安装

点击最右边加号, 选择Tensorflow 然后点击install  ok    完成

使用测试代码 检查是否安装成功  定义两个常量(tf.constant)  然后将其相加  要输出相加结果 需要生成一个session来计算

import tensorflow as tf

a = tf.constant([1.0,2.0], name = 'a')
b = tf.constant([2.0,3.0], name="b")
result = a+b
sess = tf.Session()
print(sess.run(result))

结果出现错误

/home/sun/PycharmProjects/mechinelearning/venv/bin/python /home/sun/PycharmProjects/mechinelearning/ch2/test.py
2019-02-09 17:59:38.627974: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your cpu supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA

Process finished with exit code 0

当前的cpu可以支持未编译为二进制的指令AVX2    消除此提示   添加两行代码

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

运行结果

 

相关文章

MNIST数据集可以说是深度学习的入门,但是使用模型预测单张M...
1、新建tensorflow环境(1)打开anacondaprompt,输入命令行...
这篇文章主要介绍“张量tensor是什么”,在日常操作中,相信...
tensorflow中model.fit()用法model.fit()方法用于执行训练过...
https://blog.csdn.net/To_be_little/article/details/12443...
根据身高推测体重const$=require('jquery');const...