Skip to content

Commit 0bce986

Browse files
committed
update to v1.7
1 parent 5d59924 commit 0bce986

36 files changed

+925
-551
lines changed

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
-----------------
66

7-
| **`Linux CPU`** | **`Linux GPU`** | **`Mac OS CPU`** | **`Windows CPU`** | **`Android`** |
8-
|-----------------|---------------------|------------------|-------------------|---------------|
9-
| [![Build Status](https://ci.tensorflow.org/buildStatus/icon?job=tensorflow-master-cpu)](https://ci.tensorflow.org/job/tensorflow-master-cpu) | [![Build Status](https://ci.tensorflow.org/buildStatus/icon?job=tensorflow-master-linux-gpu)](https://ci.tensorflow.org/job/tensorflow-master-linux-gpu) | [![Build Status](https://ci.tensorflow.org/buildStatus/icon?job=tensorflow-master-mac)](https://ci.tensorflow.org/job/tensorflow-master-mac) | [![Build Status](https://ci.tensorflow.org/buildStatus/icon?job=tensorflow-master-win-cmake-py)](https://ci.tensorflow.org/job/tensorflow-master-win-cmake-py) | [![Build Status](https://ci.tensorflow.org/buildStatus/icon?job=tensorflow-master-android)](https://ci.tensorflow.org/job/tensorflow-master-android) [ ![Download](https://api.bintray.com/packages/google/tensorflow/tensorflow/images/download.svg) ](https://bintray.com/google/tensorflow/tensorflow/_latestVersion) |
7+
8+
| **`Documentation`** | **`Linux CPU`** | **`Linux GPU`** | **`Mac OS CPU`** | **`Windows CPU`** | **`Android`** |
9+
|-----------------|---------------------|------------------|-------------------|---------------|---------------|
10+
| [![Documentation](https://img.shields.io/badge/api-reference-blue.svg)](https://www.tensorflow.org/api_docs/) | [![Build Status](https://ci.tensorflow.org/buildStatus/icon?job=tensorflow-master-cpu)](https://ci.tensorflow.org/job/tensorflow-master-cpu) | [![Build Status](https://ci.tensorflow.org/buildStatus/icon?job=tensorflow-master-linux-gpu)](https://ci.tensorflow.org/job/tensorflow-master-linux-gpu) | [![Build Status](https://ci.tensorflow.org/buildStatus/icon?job=tensorflow-master-mac)](https://ci.tensorflow.org/job/tensorflow-master-mac) | [![Build Status](https://ci.tensorflow.org/buildStatus/icon?job=tensorflow-master-win-cmake-py)](https://ci.tensorflow.org/job/tensorflow-master-win-cmake-py) | [![Build Status](https://ci.tensorflow.org/buildStatus/icon?job=tensorflow-master-android)](https://ci.tensorflow.org/job/tensorflow-master-android) [ ![Download](https://api.bintray.com/packages/google/tensorflow/tensorflow/images/download.svg) ](https://bintray.com/google/tensorflow/tensorflow/_latestVersion)
1011

1112
**TensorFlow** is an open source software library for numerical computation using
1213
data flow graphs. The graph nodes represent mathematical operations, while
@@ -21,20 +22,6 @@ organization for the purposes of conducting machine learning and deep neural
2122
networks research. The system is general enough to be applicable in a wide
2223
variety of other domains, as well.
2324

24-
**If you want to contribute to TensorFlow, be sure to review the [contribution
25-
guidelines](CONTRIBUTING.md). This project adheres to TensorFlow's
26-
[code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to
27-
uphold this code.**
28-
29-
**We use [GitHub issues](https://github.com/tensorflow/tensorflow/issues) for
30-
tracking requests and bugs. So please see
31-
[TensorFlow Discuss](https://groups.google.com/a/tensorflow.org/forum/#!forum/discuss) for general questions
32-
and discussion, and please direct specific questions to [Stack Overflow](https://stackoverflow.com/questions/tagged/tensorflow).**
33-
34-
The TensorFlow project strives to abide by generally accepted best practices in open-source software development:
35-
36-
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1486/badge)](https://bestpractices.coreinfrastructure.org/projects/1486)
37-
3825
## Installation
3926
*See [Installing TensorFlow](https://www.tensorflow.org/get_started/os_setup.html) for instructions on how to install our release binaries or how to build from source.*
4027

@@ -75,6 +62,22 @@ $ python
7562
>>> sess.close()
7663
```
7764

65+
## Contribution guidelines
66+
67+
**If you want to contribute to TensorFlow, be sure to review the [contribution
68+
guidelines](CONTRIBUTING.md). This project adheres to TensorFlow's
69+
[code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to
70+
uphold this code.**
71+
72+
**We use [GitHub issues](https://github.com/tensorflow/tensorflow/issues) for
73+
tracking requests and bugs. So please see
74+
[TensorFlow Discuss](https://groups.google.com/a/tensorflow.org/forum/#!forum/discuss) for general questions
75+
and discussion, and please direct specific questions to [Stack Overflow](https://stackoverflow.com/questions/tagged/tensorflow).**
76+
77+
The TensorFlow project strives to abide by generally accepted best practices in open-source software development:
78+
79+
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1486/badge)](https://bestpractices.coreinfrastructure.org/projects/1486)
80+
7881
## For more information
7982

8083
* [TensorFlow Website](https://www.tensorflow.org)

deploy/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ the following documents:
77
a cluster of TensorFlow servers.
88
* @{$hadoop$How to run TensorFlow on Hadoop}, which has a highly
99
self-explanatory title.
10+
* @{$s3$How to run TensorFlow with the S3 filesystem}, which explains how
11+
to run TensorFlow with the S3 file system.
1012
* The entire document set for [TensorFlow serving](/serving), an open-source,
1113
flexible, high-performance serving system for machine-learned models
1214
designed for production environments. TensorFlow Serving provides

deploy/leftnav_files

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
index.md
22
distributed.md
33
hadoop.md
4+
s3.md

deploy/s3.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# How to run TensorFlow on S3
2+
3+
This document describes how to run TensorFlow on S3 file system.
4+
5+
## S3
6+
7+
We assume that you are familiar with @{$reading_data$reading data}.
8+
9+
To use S3 with TensorFlow, change the file paths you use to read and write
10+
data to an S3 path. For example:
11+
12+
```python
13+
filenames = ["s3://bucketname/path/to/file1.tfrecord",
14+
"s3://bucketname/path/to/file2.tfrecord"]
15+
dataset = tf.data.TFRecordDataset(filenames)
16+
```
17+
18+
When reading or writing data on S3 with your TensorFlow program, the behavior
19+
could be controlled by various environmental variables:
20+
21+
* **AWS_REGION**: By default, regional endpoint is used for S3, with region
22+
controlled by `AWS_REGION`. If `AWS_REGION` is not specified, then
23+
`us-east-1` is used.
24+
* **S3_ENDPOINT**: The endpoint could be overridden explicitly with
25+
`S3_ENDPOINT` specified.
26+
* **S3_USE_HTTPS**: HTTPS is used to access S3 by default, unless
27+
`S3_USE_HTTPS=0`.
28+
* **S3_VERIFY_SSL**: If HTTPS is used, SSL verification could be disabled
29+
with `S3_VERIFY_SSL=0`.
30+
31+
To read or write objects in a bucket that is no publicly accessible,
32+
AWS credentials must be provided through one of the following methods:
33+
34+
* Set credentials in the AWS credentials profile file on the local system,
35+
located at: `~/.aws/credentials` on Linux, macOS, or Unix, or
36+
`C:\Users\USERNAME\.aws\credentials` on Windows.
37+
* Set the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment
38+
variables.
39+
* If TensorFlow is deployed on an EC2 instance, specify an IAM role and then
40+
give the EC2 instance access to that role.

extend/add_filesys.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ filesystem implementations call their existing libraries. Examples include:
8181
plugin](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/platform/hadoop/hadoop_file_system.h)
8282
* [GCS
8383
plugin](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/platform/cloud/gcs_file_system.h)
84+
* [S3
85+
plugin](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/platform/s3/s3_file_system.h)
8486

8587
#### The File interfaces
8688

get_started/checkpoints.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ classifier = tf.estimator.DNNClassifier(
154154

155155
The first time you call an Estimator's `train` method, TensorFlow saves a
156156
checkpoint to the `model_dir`. Each subsequent call to the Estimator's
157-
`train`, `eval`, or `predict` method causes the following:
157+
`train`, `evaluate`, or `predict` method causes the following:
158158

159159
1. The Estimator builds the model's
160160
[graph](https://developers.google.com/machine-learning/glossary/#graph)
@@ -222,7 +222,7 @@ does not match the shape stored in checkpoint: [20]
222222

223223
To run experiments in which you train and compare slightly different
224224
versions of a model, save a copy of the code that created each
225-
`model-dir`, possibly by creating a separate git branch for each version.
225+
`model_dir`, possibly by creating a separate git branch for each version.
226226
This separation will keep your checkpoints recoverable.
227227

228228
## Summary

get_started/custom_estimators.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,12 @@ classifier = tf.estimator.Estimator(
161161

162162
To implement a typical model function, you must do the following:
163163

164-
* (Define the model)[#define_the_model].
164+
* [Define the model](#define_the_model).
165165
* Specify additional calculations for each of
166166
the [three different modes](#modes):
167-
* [Predict](#predict)
168-
* [Evaluate](#evaluate)
169-
* [Train](#train)
167+
* [Predict](#predict)
168+
* [Evaluate](#evaluate)
169+
* [Train](#train)
170170

171171
## Define the model
172172

@@ -213,7 +213,7 @@ is connected to every node in the preceding layer. Here's the relevant code:
213213
```
214214

215215
* The `units` parameter defines the number of output neurons in a given layer.
216-
* The `activation` parameter defines the [activation function](https://developers.google.com/machine-learning/glossary/#a)
216+
* The `activation` parameter defines the [activation function](https://developers.google.com/machine-learning/glossary/#activation_function)
217217
[Relu](https://developers.google.com/machine-learning/glossary/#ReLU) in this
218218
case.
219219

@@ -546,8 +546,8 @@ In brief, here's what the three graphs tell you:
546546

547547
* accuracy: The accuracy is recorded by the following two lines:
548548

549-
* `eval_metric_ops={'my_accuracy': accuracy})`, during evaluation.
550-
* `tf.summary.scalar('accuracy', accuracy[1])`, during training.
549+
* `eval_metric_ops={'my_accuracy': accuracy})`, during evaluation.
550+
* `tf.summary.scalar('accuracy', accuracy[1])`, during training.
551551

552552
These tensorboard graphs are one of the main reasons it's important to pass a
553553
`global_step` to your optimizer's `minimize` method. The model can't record

get_started/datasets_quickstart.md

Lines changed: 37 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def train_input_fn(features, labels, batch_size):
2828
# Shuffle, repeat, and batch the examples.
2929
dataset = dataset.shuffle(1000).repeat().batch(batch_size)
3030

31-
# Build the Iterator, and return the read end of the pipeline.
32-
return dataset.make_one_shot_iterator().get_next()
31+
# Return the dataset.
32+
return dataset
3333
```
3434

3535
Let's look at this more closely.
@@ -40,7 +40,7 @@ This function expects three arguments. Arguments expecting an "array" can
4040
accept nearly anything that can be converted to an array with `numpy.array`.
4141
One exception is
4242
[`tuple`](https://docs.python.org/3/tutorial/datastructures.html#tuples-and-sequences)
43-
which has special meaning for `Datasets`.
43+
which, as we will see, has special meaning for `Datasets`.
4444

4545
* `features`: A `{'feature_name':array}` dictionary (or
4646
[`DataFrame`](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html))
@@ -73,11 +73,12 @@ Let's walk through the `train_input_fn()`.
7373

7474
### Slices
7575

76-
In the simplest cases, @{tf.data.Dataset.from_tensor_slices} function takes an
77-
array and returns a @{tf.data.Dataset} representing slices of the array. For
78-
example, an array containing the @{$tutorials/layers$mnist training data}
79-
has a shape of `(60000, 28, 28)`. Passing this to `from_tensor_slices` returns
80-
a `Dataset` object containing 60000 slices, each one a 28x28 image.
76+
The function starts by using the @{tf.data.Dataset.from_tensor_slices} function
77+
to create a @{tf.data.Dataset} representing slices of the array. The array is
78+
sliced across the first dimension. For example, an array containing the
79+
@{$tutorials/layers$mnist training data} has a shape of `(60000, 28, 28)`.
80+
Passing this to `from_tensor_slices` returns a `Dataset` object containing
81+
60000 slices, each one a 28x28 image.
8182

8283
The code that returns this `Dataset` is as follows:
8384

@@ -89,18 +90,24 @@ mnist_ds = tf.data.Dataset.from_tensor_slices(mnist_x)
8990
print(mnist_ds)
9091
```
9192

92-
This will print the following line, showing the @{$programmers_guide/tensors#shapes$shapes} and @{$programmers_guide/tensors#data_types$types} of the items in
93-
the dataset. Note that the dataset does not know how many items it contains.
93+
This will print the following line, showing the
94+
@{$programmers_guide/tensors#shapes$shapes} and
95+
@{$programmers_guide/tensors#data_types$types} of the items in
96+
the dataset. Note that a `Dataset` does not know how many items it contains.
9497

9598
``` None
9699
<TensorSliceDataset shapes: (28,28), types: tf.uint8>
97100
```
98101

99-
The dataset above represents a collection of simple arrays, but datasets are
100-
much more powerful than this. Datasets transparently handle any nested
101-
combination of dictionaries or tuples. For example, ensuring that `features`
102-
is a standard dictionary, you can then convert the dictionary of arrays to
103-
a `Dataset` of dictionaries as follows:
102+
The `Dataset` above represents a simple collection of arrays, but datasets are
103+
much more powerful than this. A `Dataset` can transparently handle any nested
104+
combination of dictionaries or tuples (or
105+
[`namedtuple`](https://docs.python.org/2/library/collections.html#collections.namedtuple)
106+
).
107+
108+
For example after converting the iris `features`
109+
to a standard python dictionary, you can then convert the dictionary of arrays
110+
to a `Dataset` of dictionaries as follows:
104111

105112
``` python
106113
dataset = tf.data.Dataset.from_tensor_slices(dict(features))
@@ -124,9 +131,9 @@ and `types` of the `Dataset` take on the same structure. This dataset contains
124131
dictionaries of @{$programmers_guide/tensors#rank$scalars}, all of type
125132
`tf.float64`.
126133

127-
The first line of `train_input_fn` uses the same functionality, but adds
128-
another level of structure. It creates a dataset containing
129-
`(features, labels)` pairs.
134+
The first line of the iris `train_input_fn` uses the same functionality, but
135+
adds another level of structure. It creates a dataset containing
136+
`(features_dict, label)` pairs.
130137

131138
The following code shows that the label is a scalar with type `int64`:
132139

@@ -164,14 +171,14 @@ dataset = dataset.shuffle(1000).repeat().batch(batch_size)
164171
```
165172

166173
The @{tf.data.Dataset.shuffle$`shuffle`} method uses a fixed-size buffer to
167-
shuffle the items as they pass through. Setting a `buffer_size` greater than
168-
the number of examples in the `Dataset` ensures that the data is completely
169-
shuffled. The Iris data set only contains 150 examples.
174+
shuffle the items as they pass through. In this case the `buffer_size` is
175+
greater than the number of examples in the `Dataset`, ensuring that the data is
176+
completely shuffled (The Iris data set only contains 150 examples).
170177

171-
The @{tf.data.Dataset.repeat$`repeat`} method has the `Dataset` restart when
178+
The @{tf.data.Dataset.repeat$`repeat`} method restarts the `Dataset` when
172179
it reaches the end. To limit the number of epochs, set the `count` argument.
173180

174-
The @{tf.data.Dataset.repeat$`batch`} method collects a number of examples and
181+
The @{tf.data.Dataset.batch$`batch`} method collects a number of examples and
175182
stacks them, to create batches. This adds a dimension to their shape. The new
176183
dimension is added as the first dimension. The following code uses
177184
the `batch` method on the MNIST `Dataset`, from earlier. This results in a
@@ -213,35 +220,16 @@ print(dataset)
213220

214221
### Return
215222

216-
<!-- TODO(markdaoust) This line can be simplified to "return dataset" -->
223+
At this point the `Dataset` contains `(features_dict, labels)` pairs.
224+
This is the format expected by the `train` and `evaluate` methods, so the
225+
`input_fn` returns the dataset.
217226

218-
The `train`, `evaluate`, and `predict` methods of every Estimator require
219-
input functions to return a `(features, label)` pair containing
220-
@{$programmers_guide/tensors$tensorflow tensors}. The `train_input_fn` uses
221-
the following line to convert the Dataset into the expected format:
227+
The `labels` can/should be omitted when using the `predict` method.
222228

223-
```python
224-
# Build the Iterator, and return the read end of the pipeline.
225-
features_result, labels_result = dataset.make_one_shot_iterator().get_next()
226-
```
229+
<!--
230+
TODO(markdaoust): link to `input_fn` doc when it exists
231+
-->
227232

228-
The result is a structure of @{$programmers_guide/tensors$TensorFlow tensors},
229-
matching the layout of the items in the `Dataset`.
230-
For an introduction to what these objects are and how to work with them,
231-
see @{$programmers_guide/low_level_intro}.
232-
233-
``` python
234-
print((features_result, labels_result))
235-
```
236-
237-
```None
238-
({
239-
'SepalLength': <tf.Tensor 'IteratorGetNext:2' shape=(?,) dtype=float64>,
240-
'PetalWidth': <tf.Tensor 'IteratorGetNext:1' shape=(?,) dtype=float64>,
241-
'PetalLength': <tf.Tensor 'IteratorGetNext:0' shape=(?,) dtype=float64>,
242-
'SepalWidth': <tf.Tensor 'IteratorGetNext:3' shape=(?,) dtype=float64>},
243-
Tensor("IteratorGetNext_1:4", shape=(?,), dtype=int64))
244-
```
245233

246234
## Reading a CSV File
247235

@@ -277,9 +265,6 @@ ds = tf.data.TextLineDataset(train_path).skip(1)
277265

278266
### Build a csv line parser
279267

280-
Ultimately we will need to parse each of the lines in the dataset, to
281-
produce the necessary `(features, label)` pairs.
282-
283268
We will start by building a function to parse a single line.
284269

285270
The following `iris_data.parse_line` function accomplishes this task using the

get_started/feature_columns.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ single input number into a four-element vector. Therefore, the model now can
146146
learn _four individual weights_ rather than just one; four weights creates a
147147
richer model than one weight. More importantly, bucketizing enables the model
148148
to clearly distinguish between different year categories since only one of the
149-
elements is set (1) and the other three elements are cleared (0). When we just
150-
use a single number (a year) as input, the model can only learn a linear
151-
relationship. So, bucketing provides the model with additional flexibility that
152-
the model can use to learn.
149+
elements is set (1) and the other three elements are cleared (0). For example,
150+
when we just use a single number (a year) as input, a linear model can only
151+
learn a linear relationship. So, bucketing provides the model with additional
152+
flexibility that the model can use to learn.
153153

154154
The following code demonstrates how to create a bucketized feature:
155155

@@ -242,7 +242,7 @@ on an explicit vocabulary list. For example:
242242
# the elements in the vocabulary list.
243243
vocabulary_feature_column =
244244
tf.feature_column.categorical_column_with_vocabulary_list(
245-
key="a feature returned by input_fn()",
245+
key=feature_name_from_input_fn,
246246
vocabulary_list=["kitchenware", "electronics", "sports"])
247247
```
248248

@@ -259,7 +259,7 @@ you place the vocabulary words in a separate file. For example:
259259
# the elements in the vocabulary file
260260
vocabulary_feature_column =
261261
tf.feature_column.categorical_column_with_vocabulary_file(
262-
key="a feature returned by input_fn()",
262+
key=feature_name_from_input_fn,
263263
vocabulary_file="product_class.txt",
264264
vocabulary_size=3)
265265
```

0 commit comments

Comments
 (0)