注解

在我们在TensorFlow中建立基本的对象和方法之后,我们想要建立可以组成TensorFlow算法的成分。我们可以从引入计算图开始,然后我们在转向损失函数和反向传播。在本章的末尾,我们会创造一个简单的分类器然后展示一个回归和分类的算法。

下载本章 Jupyter Notebook

CSS

计算图

我们会展示如何在计算图中创建一个算符,并用Tensorboard来展示它。

下载本章 Jupyter Notebook


分层嵌套操作

We show how to create multiple operations on a computational graph and how to visualize them using Tensorboard.

下载本章 Jupyter Notebook


多层操作

Here we extend the usage of the computational graph to create multiple layers and show how they appear in Tensorboard.

下载本章 Jupyter Notebook


载入损失函数

In order to train a model, we must be able to evaluate how well it is doing. This is given by loss functions. We plot various loss functions and talk about the benefits and limitations of some.

下载本章 Jupyter Notebook


载入反向传播

Here we show how to use loss functions to iterate through data and back propagate errors for regression and classification.

下载本章 Jupyter Notebook

随机和批量训练

TensorFlow makes it easy to use both batch and stochastic training. We show how to implement both and talk about the benefits and limitations of each.

下载本章 Jupyter Notebook



模型评估

Any model is only as good as it’s evaluation. Here we show two examples of (1) evaluating a regression algorithm and (2) a classification algorithm.

下载本章 Jupyter Notebook

本章学习模块

tensorflow.zeros

Creates a tensor with all elements set to zero.

See also tf.zeros_like, tf.ones, tf.fill, tf.eye.

This operation returns a tensor of type dtype with shape shape and all elements set to zero.

>>> tf.zeros([3, 4], tf.int32)
<tf.Tensor: shape=(3, 4), dtype=int32, numpy=
array([[0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0]], dtype=int32)>
param shape:A list of integers, a tuple of integers, or a 1-D Tensor of type int32.
param dtype:The DType of an element in the resulting Tensor.
param name:Optional string. A name for the operation.
returns:A Tensor with all elements set to zero.

tensorflow.ones

Creates a tensor with all elements set to one (1).

See also tf.ones_like, tf.zeros, tf.fill, tf.eye.

This operation returns a tensor of type dtype with shape shape and all elements set to one.

>>> tf.ones([3, 4], tf.int32)
<tf.Tensor: shape=(3, 4), dtype=int32, numpy=
array([[1, 1, 1, 1],
       [1, 1, 1, 1],
       [1, 1, 1, 1]], dtype=int32)>
param shape:A list of integers, a tuple of integers, or a 1-D Tensor of type int32.
param dtype:Optional DType of an element in the resulting Tensor. Default is tf.float32.
param name:Optional string. A name for the operation.
returns:A Tensor with all elements set to one (1).