Tensorflow快速入门教程
来源:互联网 发布:贴吧网盘网络出错 编辑:程序博客网 时间:2024/06/06 10:54
什么是Tensorflow?
- Tensorflow是google发布的深度学习开源框架
- Tensorflow提供了定义张量的函数,而且可以自动的计算导数
TensorFlow VS. Numpy
- Few people make this comparison, but TensorFlow and
Numpy are quite similar. (Both are N-d array libraries!) - Numpy has Ndarray support, but doesn’t offer methods to
create tensor functions and automatically compute
derivatives (+ no GPU support).
Simple Numpy Recap
In [23]: import numpy as npIn [24]: a = np.zeros((2,2)); b = np.ones((2,2))In [25]: np.sum(b, axis=1)Out[25]: array([ 2., 2.])In [26]: a.shapeOut[26]: (2, 2)In [27]: np.reshape(a, (1,4))Out[27]: array([[ 0., 0., 0., 0.]])
Repeat in TensorFlow
In [31]: import tensorflow as tfIn [32]: tf.InteractiveSession() ##More on SessionsoonIn [33]: a = tf.zeros((2,2)); b = tf.ones((2,2))In [34]: tf.reduce_sum(b, reduction_indices=1).eval()Out[34]: array([ 2., 2.], dtype=float32)In [35]: a.get_shape() ##TensorShape behaveslike a python tuple.Out[35]: TensorShape([Dimension(2), Dimension(2)])In [36]: tf.reshape(a, (1, 4)).eval()Out[36]: array([[ 0., 0., 0., 0.]], dtype=float32)
● tf.InteractiveSession() is just convenient syntactic sugar for keeping a default session open in ipython.
● sess.run(c) is an example of a TensorFlow Fetch. Will say more on this soon
Tensorflow Computation Graph
- TensorFlow programs are usually structured into a construction phase, that assembles a graph, and an execution phase that uses a session to execute ops in the graph.
- All computations add nodes to global default graph
Tensorflow Variables
-“When you train a model you use variables to hold and update parameters. Variables are in-memory buffers containing tensors
- All tensors we’ve used previously have been constant tensors, not variables
Updating Variable State
Fetch Variable State
Inputing Data
Variable Scope
Understanding get_variable()
Tensorflow实战:线性回归
计算流图如下所示:
Tips: 关于更多的Tensorflow教程请参考Tensorflow中文社区http://www.tensorfly.cn/以及莫烦老师一系列的Tensorflow教程http://list.youku.com/albumlist/show?id=27327189&asce,谢谢大家!
0 0
- Tensorflow快速入门教程
- tensorflow入门教程
- TensorFlow入门教程
- TensorFlow入门教程
- tensorFlow入门教程
- TensorFlow入门教程
- Tensorflow入门教程【1】---Hello TensorFlow
- TensorFlow 完整的TensorFlow入门教程
- 【TensorFlow】TensorFlow快速入门
- TensorFlow入门教程集合
- Tensorflow入门教程-1
- TensorFlow入门教程集合
- TensorFlow下载安装&入门教程
- TensorFlow入门教程合集
- TensorFlow入门教程集合
- TensorFlow入门教程:2:概述
- TensorFlow基础用法入门教程
- TensorFlow入门教程(3)
- Android ListView应用
- Spring Scheduled定时任务动态修改cron参数
- java网络编程基础知识预热
- bzoj1079 [SCOI2008]着色方案
- LaunchModel以及Intent相关FLAG介绍
- Tensorflow快速入门教程
- CsCouchBaseHelper.cs
- Eclipse找不到或无法加载主类的解决办法
- 串口编程框架
- leetcode 383 Ransom Note
- 我思故我在,技术博客写起来!
- <LearnWLS> How to setup Weblogic official sample - EJB
- 即使是空谈,我也要提醒自己
- 25.Yii 模块