CS20SI Tensorflow for Deeplearning课程笔记(一)

一、 课程目标

  1. 理解TF的计算图方法
  2. 探索TF的内置函数
  3. 学会怎么去构建和组织最好的模型去做深度学习项目

二、书籍

  1. TensorFlow for Machine Intelligence (TFFMI)
  2. Hands-On Machine Learning with Scikit-Learn and TensorFlow. Chapter 9
    Up and running with TensorFlow
  3. Fundamentals of Deep Learning. Chapter 3: Implementing Neural Networks in TensorFlow (FODL)
    书籍容易过时,推荐tensorflow官网

三、 简化版的Tensorflow

  1. TF Learn (tf.contrib.learn)
  2. TF Slim (tf.contrib.slim):
  3. 高级版 API: Keras, TFLearn, Pretty Tensor

四、Graphs and Sessions

1. tensor

一种n维的矩阵
0-d tensor: scalar (number)
1-d tensor: vector
2-d tensor: matrix
and so on

2. Data Flow Graphs

计算a的值的方式

import tensorflow as tf
a = tf.add(3, 5)
# with clause takes care
# of sess.close()
with tf.Session() as sess:
    print sess.run(a)

数据流图如下所示
 
这里写图片描述

3. tf.Session()

主要用于执行需要计算的tensor。

x = 2
y = 3
op1 = tf.add(x, y)
op2 = tf.mul(x, y)
op3 = tf.pow(op2, op1)
with tf.Session() as sess:
    op3 = sess.run(op3)

可以将图分成几部分,然后并行地计算在CPU,GPU上,如下图所示
 
这里写图片描述

4. tf.Graph()

添加一个运算给图,并将其设为默认图

g = tf.Graph()
with g.as_default():
    a = 3
    b = 5
    x = tf.add(a, b)
    sess = tf.Session(graph=g) # session is run on the graph g
# run session
    sess.close()

获取默认的图

g = tf.get_default_graph()

不要将默认的图和用户创建的图混合在一起,如下情况会报错

g = tf.Graph()
# add ops to the default graph
a = tf.constant(3)
# add ops to the user created graph
with g.as_default():
    b = tf.constant(5)
#Prone to errors

正确的使用方式

g1 = tf.get_default_graph()
g2 = tf.Graph()
# add ops to the default graph
with g1.as_default():
    a = tf.Constant(3)
# add ops to the user created graph
    with g2.as_default():
b = tf.Constant(5)

为什么使用Graph?
1. Save computation (only run subgraphs that lead to the values you want to fetch)
2. Break computation into small, differential pieces to facilitates auto-differentiation
3. Facilitate distributed computation, spread the work across multiple CPUs, GPUs, or devices
4. Many common machine learning models are commonly taught and visualized as directed graphs already

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Key Features, Learn advanced techniques in deep learning with this example-rich guide on Google's brainchildExplore various neural networks with the help of this comprehensive guideAdvanced guide on machine learning techniques, in particular TensorFlow for deep learning., Book Description, Deep learning is the next step after machine learning. It is machine learning but with a more advanced implementation. As machine learning is no longer an academic topic, but a mainstream practice, deep learning has taken a front seat. With deep learning being used by many data scientists, deeper neural networks are evaluated for accurate results. Data scientists want to explore data abstraction layers and this book will be their guide on this journey. This book evaluates common, and not so common, deep neural networks and shows how these can be exploited in the real world with complex raw data using TensorFlow., The book will take you through an understanding of the current machine learning landscape then delve into TensorFlow and how to use it by considering various data sets and use cases. Throughout the chapters, you'll learn how to implement various deep learning algorithms for your machine learning systems and integrate them into your product offerings such as search, image recognition, and language processing. Additionally, we'll examine its performance by optimizing it with respect to its various parameters, comparing it against benchmarks along with teaching machines to learn from the information and determine the ideal behavior within a specific context, in order to maximize its performance., After finishing the book, you will be familiar with machine learning techniques, in particular TensorFlow for deep learning, and will be ready to apply some of your knowledge in a real project either in a research or commercial setting., What you will learn, Provide an overview of the machine learning landscapeLook at the historical development and progress of deep learningDescribe TensorFlow and become very familiar with it both in theory and in practiceAccess public datasets and use TF to load, process, clean, and transform dataUse TensorFlow on real-world data sets including images and textGet familiar with TensorFlow by applying it in various hands on exercises using the command lineEvaluate the performance of your deep learning modelsQuickly teach machines to learn from data by exploring reinforcement learning techniques.Understand how this technology is being used in the real world by exploring active areas of deep learning research and application.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值