TensorFlow学习笔记:2、TensorFlow超简单入门程序
来源:互联网 发布:淘宝女装海报设计 编辑:程序博客网 时间:2024/05/29 12:42
TensorFlow学习笔记:2、TensorFlow超简单入门程序
2.1 HelloWorld代码说明
import tensorflow as tf
加载TensorFlow模块hello=tf.constant(“Hello,TensorFlow!”)
定义计算图(此处定义一个常量)session=tf.Session()
获取TensorFlow的sessionprint(session.run(hello))
通过session,执行计算图
2.2 演示程序
[root@node1 ~]# pythonPython 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import tensorflow as tf>>> hello=tf.constant("Hello,TensorFlow!")>>> session=tf.Session()2017-10-14 23:26:49.914154: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.2017-10-14 23:26:49.914260: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.2017-10-14 23:26:49.914274: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.2017-10-14 23:26:49.914284: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.>>> print(session.run(hello))Hello,TensorFlow!>>>
2.3 a+b计算
>>> import tensorflow as tf>>> session=tf.Session()2017-10-14 11:23:01.914540: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.2017-10-14 11:23:01.914572: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.2017-10-14 11:23:01.914582: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.2017-10-14 11:23:01.914592: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.>>> x=tf.constant(5)>>> y=tf.constant(7)>>> print(session.run(x+y))12>>>
阅读全文
0 0
- TensorFlow学习笔记:2、TensorFlow超简单入门程序
- TensorFlow学习笔记(1):最简单的入门程序
- tensorflow入门学习笔记
- Tensorflow入门学习笔记
- Tensorflow入门学习笔记
- TensorFlow学习笔记:入门
- TensorFlow学习笔记(二):TensorFlow入门
- Tensorflow学习笔记:Debugging 调试Tensorflow 程序
- Tensorflow入门程序MNIST学习
- tensorflow 入门学习(2)
- TensorFlow学习笔记1:入门
- TensorFlow 学习笔记-入门篇
- TensorFlow学习笔记1:入门
- 2、Tensorflow:TensorFlow深度学习入门(上)
- Tensorflow学习笔记(2)
- Tensorflow学习笔记2
- TensorFlow学习笔记2
- tensorflow 学习笔记 2
- git公钥私钥定义
- codevs 1017 乘积最大
- oj Runtime error常见原因+cpp函数命名规则
- SpringMVC Exception Handler
- K路归并 例题
- TensorFlow学习笔记:2、TensorFlow超简单入门程序
- 中科院量子创新研究院联合阿里云发布量子计算云平台
- 15算法课程 100. Same Tree
- ubuntu rails连接mongodb十步实例教程
- 转录组分析的正确姿势
- 用虚拟机模拟vpn的实现
- 访问修饰符权限
- Spring Boot with Spring MVC Application
- 1001. 害死人不偿命的(3n+1)猜想 (15)