logo资料库

tensorflow中文版教程.pdf

第1页 / 共438页
第2页 / 共438页
第3页 / 共438页
第4页 / 共438页
第5页 / 共438页
第6页 / 共438页
第7页 / 共438页
第8页 / 共438页
资料共438页,剩余部分请下载后查看
起步
Introduction || 简介
Download and Setup || 下载与安装
Requirements | 安装需求
Overview | 安装总述
Pip Installatioin | Pip 安装
Virtualenv installation | 基于 Virtualenv 安装
Docker Installation
Test the TensorFlow installation | 测试 TensorFlow 安装
Installing from source
Train your first TensorFlow neural net model | 训练第一个TensorFlow模型
Common Problems | 常见问题
Basic Usage || 使用基础
Overview | 总览
The computation graph | 计算图
Interactive Usage | 交互式使用
Tensors | 张量
Variables | 变量
Fetches | 取回
Feeds | 供给
基础教程
MNIST机器学习入门
The MNIST Data | MNIST数据集
Softmax回归介绍
实现回归模型
训练模型
Evaluating Our Model || 评估我们的模型
Deep MNIST for Experts || 深入MNIST
Setup | 安装
Build a Softmax Regression Model || 构建 Softmax 回归模型
Train the Model | 训练模型
Build a Multilayer Convolutional Network | 构建多层卷积网络模型
TensorFlow Mechanics 101
教程使用的文件
准备数据
构建图表 (Build the Graph)
训练模型
评估模型
卷积神经网络
Overview
Code Organization
CIFAR-10 模型
开始执行并训练模型
评估模型
在多个GPU板卡上训练模型
下一步
Vector Representations of Words
亮点
动机: 为什么需要学习 Word Embeddings?
处理噪声对比训练
Skip-gram 模型
建立图形
训练模型
嵌套学习结果可视化
嵌套学习的评估: 类比推理
优化实现
总结
循环神经网络
介绍
语言模型
教程文件
下载及准备数据
模型
编译并运行代码
除此之外?
Sequence-to-Sequence Models
Sequence-to-Sequence Basics
TensorFlow seq2seq Library
Neural Translation Model
Let's Run It
What Next?
偏微分方程
基本设置
定义计算函数
定义偏微分方程
开始仿真
MNIST 数据下载
教程 文件
准备数据
运作方式
Variables: 创建,初始化,保存,和恢复
TensorFlow 机制 101
TensorBoard: 学习过程的可视化
TensorBoard: 图的可视化
数据读入
线程和队列
添加新的 Op
自定义数据的 Readers
使用 GPUs
共享变量 Sharing Variables
变量:创建、初始化、保存和加载
变量创建
变量初始化
保存和加载
共享变量
问题
变量作用域实例
变量作用域是怎么工作的?
使用实例
TensorBoard:可视化学习 
数据序列化 
启动TensorBoard 
TensorBoard: 图表可视化
名称域(Name scoping)和节点(Node)
交互
数据读取
目录
供给数据
从文件读取数据
预取数据
多输入管道
线程和队列
队列使用概述
Coordinator
QueueRunner
异常处理
增加一个新 Op
内容
定义 Op 的接口
为 Op 实现 kernel
生成客户端包装器
检查 Op 能否正常工作
验证条件
Op 注册
GPU 支持
使用 Python 实现梯度
在 Python 中实现一个形状函数
自定义数据读取
主要内容
编写一个文件格式读写器
编写一个记录格式Op
使用 GPUs
支持的设备
记录设备指派情况
手工指派设备
在多GPU系统里使用单一GPU
使用多个 GPU
Python API
Overview
Building Graphs
Contents
Core graph data structures
Tensor types
Utility functions
Graph collections
Defining new operations
Constants, Sequences, and Random Values
Contents
Constant Value Tensors
Sequences
Random Tensors
Variables
Contents
Variables
Variable helper functions
Saving and Restoring Variables
Sharing Variables
Sparse Variable Updates
Tensor Transformations
Contents
Casting
Shapes and Shaping
Slicing and Joining
Math
Contents
Arithmetic Operators
Basic Math Functions
Matrix Math Functions
Complex Number Functions
Reduction
Segmentation
Sequence Comparison and Indexing
Control Flow
Contents
Control Flow Operations
Logical Operators
Comparison Operators
Debugging Operations
Images
Contents
Encoding and Decoding
Resizing
Cropping
Flipping and Transposing
Image Adjustments
Sparse Tensors
Contents
Sparse Tensor Representation
Sparse to Dense Conversion
Manipulation
Inputs and Readers
Contents
Placeholders
Readers
Converting
Queues
Dealing with the filesystem
Input pipeline
Data IO (Python functions)
Contents
Data IO (Python Functions)
Neural Network
Contents
Activation Functions
Convolution
Pooling
Normalization
Losses
Classification
Embeddings
Evaluation
Candidate Sampling
Running Graphs
Contents
Session management
Error classes
Training
Contents
Optimizers
Gradient Computation
Gradient Clipping
Decaying the learning rate
Moving Averages
Coordinator and QueueRunner
Summary Operations
Adding Summaries to Event Files
Training utilities
C++ API
资源
其他
TensorFlow 指南 2016 年 1 月 28 日
2
目录 第一章 起步 11 1.1 Introduction || 简介 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.2 Download and Setup || 下载与安装 . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.2.1 Requirements |安装需求 . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.2.2 Overview | 安装总述 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.2.3 Pip Installatioin | Pip 安装 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.2.4 Virtualenv installation | 基于 Virtualenv 安装 . . . . . . . . . . . . . . . . 16 1.2.5 Docker Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.2.6 Test the TensorFlow installation | 测试 TensorFlow 安装 . . . . . . . . . . 19 1.2.7 Installing from source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 1.2.8 Train your first TensorFlow neural net model | 训练第一个 TensorFlow 模型 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 1.2.9 Common Problems | 常见问题 . . . . . . . . . . . . . . . . . . . . . . . . . 23 1.3 Basic Usage || 使用基础 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 1.3.1 Overview | 总览 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 1.3.2 The computation graph | 计算图 . . . . . . . . . . . . . . . . . . . . . . . . 27 1.3.3 Interactive Usage | 交互式使用 . . . . . . . . . . . . . . . . . . . . . . . . . 29 1.3.4 Tensors | 张量 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 1.3.5 Variables | 变量 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 1.3.6 Fetches | 取回 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 1.3.7 Feeds | 供给 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 第二章 基础教程 33 2.1 MNIST 机器学习入门 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 2.1.1 The MNIST Data | MNIST 数据集 . . . . . . . . . . . . . . . . . . . . . . . 38 2.1.2 Softmax 回归介绍 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.1.3 实现回归模型 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 2.1.4 训练模型 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 2.1.5 Evaluating Our Model || 评估我们的模型 . . . . . . . . . . . . . . . . . . . 48 2.2 Deep MNIST for Experts || 深入 MNIST . . . . . . . . . . . . . . . . . . . . . . . . 50 3
4 目录 2.2.1 Setup | 安装 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 2.2.2 Build a Softmax Regression Model || 构建 Softmax 回归模型 . . . . . . . 52 2.2.3 Train the Model | 训练模型 . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 2.2.4 Build a Multilayer Convolutional Network | 构建多层卷积网络模型 . . . 55 2.3 TensorFlow Mechanics 101 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 2.3.1 教程使用的文件 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 2.3.2 准备数据 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 2.3.3 构建图表(Build the Graph) . . . . . . . . . . . . . . . . . . . . . . . . . 61 2.3.4 训练模型 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 2.3.5 评估模型 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 2.4 卷积神经网络 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 2.4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 2.4.2 Code Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 2.4.3 CIFAR-10 模型 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 2.4.4 开始执行并训练模型 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 2.4.5 评估模型 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 2.4.6 在多个 GPU 板卡上训练模型 . . . . . . . . . . . . . . . . . . . . . . . . . 76 2.4.7 下一步 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 2.5 Vector Representations of Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 2.5.1 亮点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 2.5.2 动机: 为什么需要学习 Word Embeddings? . . . . . . . . . . . . . . . . . . 78 2.5.3 处理噪声对比训练 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 2.5.4 Skip-gram 模型 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 2.5.5 建立图形 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 2.5.6 训练模型 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 2.5.7 嵌套学习结果可视化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 2.5.8 嵌套学习的评估: 类比推理 . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 2.5.9 优化实现 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 2.5.10 总结 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 2.6 循环神经网络 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 2.6.1 介绍 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 2.6.2 语言模型 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 2.6.3 教程文件 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 2.6.4 下载及准备数据 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 2.6.5 模型 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 2.6.6 编译并运行代码 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 2.6.7 除此之外? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 2.7 Sequence-to-Sequence Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
目录 5 2.7.1 Sequence-to-Sequence Basics . . . . . . . . . . . . . . . . . . . . . . . . . 89 2.7.2 TensorFlow seq2seq Library . . . . . . . . . . . . . . . . . . . . . . . . . . 90 2.7.3 Neural Translation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 2.7.4 Let’s Run It . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 2.7.5 What Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 2.8 偏微分方程 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 2.8.1 基本设置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 2.8.2 定义计算函数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 2.8.3 定义偏微分方程 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 2.8.4 开始仿真 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 2.9 MNIST 数据下载 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 2.9.1 教程文件 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 2.9.2 准备数据 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 第三章 运作方式 101 3.0.1 Variables: 创建,初始化,保存,和恢复 . . . . . . . . . . . . . . . . . . 102 3.0.2 TensorFlow 机制 101 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 3.0.3 TensorBoard: 学习过程的可视化 . . . . . . . . . . . . . . . . . . . . . . . 102 3.0.4 TensorBoard: 图的可视化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 3.0.5 数据读入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 3.0.6 线程和队列 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 3.0.7 添加新的 Op . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 3.0.8 自定义数据的 Readers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 3.0.9 使用 GPUs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 3.0.10 共享变量 Sharing Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 3.1 变量: 创建、初始化、保存和加载 . . . . . . . . . . . . . . . . . . . . . . . . . . 104 3.1.1 变量创建 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 3.1.2 变量初始化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 3.1.3 保存和加载 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 3.2 共享变量 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 3.2.1 问题 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 3.2.2 变量作用域实例 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 3.2.3 变量作用域是怎么工作的? . . . . . . . . . . . . . . . . . . . . . . . . . . 110 3.2.4 使用实例 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 3.3 TensorBoard: 可视化学习  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 3.3.1 数据序列化  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 3.3.2 启动 TensorBoard   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 3.4 TensorBoard: 图表可视化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
6 目录 3.4.1 名称域(Name scoping)和节点(Node) . . . . . . . . . . . . . . . . . 115 3.4.2 交互 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 3.5 数据读取 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 3.5.1 目录 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 3.5.2 供给数据 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 3.5.3 从文件读取数据 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 3.5.4 预取数据 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 3.5.5 多输入管道 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 3.6 线程和队列 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 3.6.1 队列使用概述 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 3.6.2 Coordinator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 3.6.3 QueueRunner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 3.6.4 异常处理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 3.7 增加一个新 Op . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 3.7.1 内容 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 3.7.2 定义 Op 的接口 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 3.7.3 为 Op 实现 kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 3.7.4 生成客户端包装器 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 3.7.5 检查 Op 能否正常工作 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 3.7.6 验证条件 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 3.7.7 Op 注册 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 3.7.8 GPU 支持 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 3.7.9 使用 Python 实现梯度 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 3.7.10 在 Python 中实现一个形状函数 . . . . . . . . . . . . . . . . . . . . . . . . 148 3.8 自定义数据读取 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 3.8.1 主要内容 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 3.8.2 编写一个文件格式读写器 . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 3.8.3 编写一个记录格式 Op . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 3.9 使用 GPUs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 3.9.1 支持的设备 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 3.9.2 记录设备指派情况 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 3.9.3 手工指派设备 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 3.9.4 在多 GPU 系统里使用单一 GPU . . . . . . . . . . . . . . . . . . . . . . . . 156 3.9.5 使用多个 GPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 第四章 Python API 159 4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 4.2 Building Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
目录 7 4.2.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 4.2.2 Core graph data structures . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 4.2.3 Tensor types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 4.2.4 Utility functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 4.2.5 Graph collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 4.2.6 Defining new operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 4.3 Constants, Sequences, and Random Values . . . . . . . . . . . . . . . . . . . . . . 193 4.3.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 4.3.2 Constant Value Tensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 4.3.3 Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 4.3.4 Random Tensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 4.4 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 4.4.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 4.4.2 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 4.4.3 Variable helper functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 4.4.4 Saving and Restoring Variables . . . . . . . . . . . . . . . . . . . . . . . . . 211 4.4.5 Sharing Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 4.4.6 Sparse Variable Updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 4.5 Tensor Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 4.5.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 4.5.2 Casting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 4.5.3 Shapes and Shaping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 4.5.4 Slicing and Joining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 4.6 Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 4.6.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 4.6.2 Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 4.6.3 Basic Math Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 4.6.4 Matrix Math Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 4.6.5 Complex Number Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 262 4.6.6 Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 4.6.7 Segmentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 4.6.8 Sequence Comparison and Indexing . . . . . . . . . . . . . . . . . . . . . 274 4.7 Control Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 4.7.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 4.7.2 Control Flow Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 4.7.3 Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 4.7.4 Comparison Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 4.7.5 Debugging Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
8 目录 4.8 Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 4.8.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 4.8.2 Encoding and Decoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 4.8.3 Resizing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 4.8.4 Cropping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 4.8.5 Flipping and Transposing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 4.8.6 Image Adjustments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 4.9 Sparse Tensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 4.9.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 4.9.2 Sparse Tensor Representation . . . . . . . . . . . . . . . . . . . . . . . . . 310 4.9.3 Sparse to Dense Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . 313 4.9.4 Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 4.10 Inputs and Readers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 4.10.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 4.10.2 Placeholders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 4.10.3 Readers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 4.10.4 Converting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 4.10.5 Queues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342 4.10.6 Dealing with the filesystem . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 4.10.7 Input pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 4.11 Data IO (Python functions) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 4.11.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 4.11.2 Data IO (Python Functions) . . . . . . . . . . . . . . . . . . . . . . . . . . 356 4.12 Neural Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 4.12.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 4.12.2 Activation Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 4.12.3 Convolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 4.12.4 Pooling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 4.12.5 Normalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 4.12.6 Losses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 4.12.7 Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 4.12.8 Embeddings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 4.12.9 Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374 4.12.10 Candidate Sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 4.13 Running Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 4.13.1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 4.13.2 Session management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 4.13.3 Error classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
分享到:
收藏