From 2c858368c8c4b7e82c8d134786026a62a72d2676 Mon Sep 17 00:00:00 2001
From: Randy West
Date: Mon, 18 Dec 2017 18:22:03 -0500
Subject: [PATCH 001/519] Compute test accuracy in batches to avoid OOM on
GPUs. Reported here: https://github.com/tensorflow/tensorflow/issues/136
Alternative to this for mnist_deep.py:
https://github.com/tensorflow/tensorflow/pull/157
---
tensorflow/examples/tutorials/mnist/mnist_deep.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/tensorflow/examples/tutorials/mnist/mnist_deep.py b/tensorflow/examples/tutorials/mnist/mnist_deep.py
index 1e0294db27..2699738735 100644
--- a/tensorflow/examples/tutorials/mnist/mnist_deep.py
+++ b/tensorflow/examples/tutorials/mnist/mnist_deep.py
@@ -34,6 +34,8 @@ from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
+import numpy
+
FLAGS = None
@@ -164,8 +166,13 @@ def main(_):
print('step %d, training accuracy %g' % (i, train_accuracy))
train_step.run(feed_dict={x: batch[0], y_: batch[1], keep_prob: 0.5})
- print('test accuracy %g' % accuracy.eval(feed_dict={
- x: mnist.test.images, y_: mnist.test.labels, keep_prob: 1.0}))
+ # compute in batches to avoid OOM on GPUs
+ accuracy_l = []
+ for i in range(50):
+ batch = mnist.test.next_batch(500, shuffle=False)
+ accuracy_l.append(accuracy.eval(feed_dict={x: batch[0], y_: batch[1], keep_prob: 1.0}))
+ print('test accuracy %g' % numpy.mean(accuracy_l))
+
if __name__ == '__main__':
parser = argparse.ArgumentParser()
--
GitLab
From 3f18817317940253e6ec0e6b412492c5add5927b Mon Sep 17 00:00:00 2001
From: Randy West
Date: Mon, 18 Dec 2017 23:18:30 -0500
Subject: [PATCH 002/519] Fix basic arithmetic fail + make loop pythonic
---
tensorflow/examples/tutorials/mnist/mnist_deep.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tensorflow/examples/tutorials/mnist/mnist_deep.py b/tensorflow/examples/tutorials/mnist/mnist_deep.py
index 2699738735..47d2777813 100644
--- a/tensorflow/examples/tutorials/mnist/mnist_deep.py
+++ b/tensorflow/examples/tutorials/mnist/mnist_deep.py
@@ -168,7 +168,7 @@ def main(_):
# compute in batches to avoid OOM on GPUs
accuracy_l = []
- for i in range(50):
+ for _ in range(20):
batch = mnist.test.next_batch(500, shuffle=False)
accuracy_l.append(accuracy.eval(feed_dict={x: batch[0], y_: batch[1], keep_prob: 1.0}))
print('test accuracy %g' % numpy.mean(accuracy_l))
--
GitLab
From 5eb246cb79e37b6a7006b6dead99219ffd25de31 Mon Sep 17 00:00:00 2001
From: DavidNorman
Date: Wed, 16 May 2018 17:05:24 +0100
Subject: [PATCH 003/519] Don't do int64 tests for devices which do not support
int64
---
tensorflow/compiler/tests/binary_ops_test.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tensorflow/compiler/tests/binary_ops_test.py b/tensorflow/compiler/tests/binary_ops_test.py
index 1e4dd32916..64eeed8312 100644
--- a/tensorflow/compiler/tests/binary_ops_test.py
+++ b/tensorflow/compiler/tests/binary_ops_test.py
@@ -686,11 +686,12 @@ class BinaryOpsTest(XLATestCase):
np.array([[10], [7], [2]], dtype=np.float32),
np.float32(7),
expected=np.array([[False], [False], [True]], dtype=np.bool))
- self._testBinary(
- less_op,
- np.array([[10], [7], [2], [-1]], dtype=np.int64),
- np.int64(7),
- expected=np.array([[False], [False], [True], [True]], dtype=np.bool))
+ if np.int64 in self.numeric_types:
+ self._testBinary(
+ less_op,
+ np.array([[10], [7], [2], [-1]], dtype=np.int64),
+ np.int64(7),
+ expected=np.array([[False], [False], [True], [True]], dtype=np.bool))
for less_equal_op in [math_ops.less_equal, (lambda x, y: x <= y)]:
self._testBinary(
--
GitLab
From 8f3635d15438af7c8f6f047a5999352d14901db7 Mon Sep 17 00:00:00 2001
From: Yong Tang
Date: Thu, 17 May 2018 17:50:20 +0000
Subject: [PATCH 004/519] Improve fast_tensor_util for bfloat16
In 19180, improvement has been done to speed up the
fast_tensor_util for `float16`. As both `float16`
and `bfloat16` uses the same size, `bfloat16`
could be improved as well. This fix speeds up `bfloat16`
in a similiar fashion as `float16`.
This fix is related to 19180.
Signed-off-by: Yong Tang
---
tensorflow/python/framework/fast_tensor_util.pyx | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tensorflow/python/framework/fast_tensor_util.pyx b/tensorflow/python/framework/fast_tensor_util.pyx
index 17d112a1ec..2e3e15f53a 100644
--- a/tensorflow/python/framework/fast_tensor_util.pyx
+++ b/tensorflow/python/framework/fast_tensor_util.pyx
@@ -6,6 +6,13 @@ cimport numpy as np
from tensorflow.python.util import compat
+def AppendBFloat16ArrayToTensorProto(
+ tensor_proto, np.ndarray[np.uint16_t, ndim=1] nparray):
+ cdef long i, n
+ n = nparray.size
+ for i in range(n):
+ tensor_proto.half_val.append(nparray[i])
+
def AppendFloat16ArrayToTensorProto(
# For numpy, npy_half is a typedef for npy_uint16,
--
GitLab
From 6d5f5efadc6047828e79e0bdb4af133e0269faa7 Mon Sep 17 00:00:00 2001
From: Yong Tang
Date: Thu, 17 May 2018 17:53:07 +0000
Subject: [PATCH 005/519] Update tensorflow/python/framework/tensor_util.py
Signed-off-by: Yong Tang
---
tensorflow/python/framework/tensor_util.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tensorflow/python/framework/tensor_util.py b/tensorflow/python/framework/tensor_util.py
index ca63efbc84..ebb1db534c 100644
--- a/tensorflow/python/framework/tensor_util.py
+++ b/tensorflow/python/framework/tensor_util.py
@@ -67,10 +67,14 @@ def SlowAppendBFloat16ArrayToTensorProto(tensor_proto, proto_values):
[ExtractBitsFromBFloat16(x) for x in proto_values])
+def FastAppendBFloat16ArrayToTensorProto(tensor_proto, proto_values):
+ fast_tensor_util.AppendBFloat16ArrayToTensorProto(tensor_proto, np.asarray(proto_values, dtype=dtypes.bfloat16.as_numpy_dtype).view(np.uint16))
+
+
if _FAST_TENSOR_UTIL_AVAILABLE:
_NP_TO_APPEND_FN = {
dtypes.bfloat16.as_numpy_dtype:
- SlowAppendBFloat16ArrayToTensorProto,
+ FastAppendBFloat16ArrayToTensorProto,
np.float16:
_MediumAppendFloat16ArrayToTensorProto,
np.float32:
--
GitLab
From 535fa4919c9e247e2df673d8af874c3a39a38976 Mon Sep 17 00:00:00 2001
From: Yong Tang
Date: Thu, 17 May 2018 17:55:10 +0000
Subject: [PATCH 006/519] Pylint fix.
Signed-off-by: Yong Tang
---
tensorflow/python/framework/tensor_util.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tensorflow/python/framework/tensor_util.py b/tensorflow/python/framework/tensor_util.py
index ebb1db534c..e229d6105e 100644
--- a/tensorflow/python/framework/tensor_util.py
+++ b/tensorflow/python/framework/tensor_util.py
@@ -68,7 +68,9 @@ def SlowAppendBFloat16ArrayToTensorProto(tensor_proto, proto_values):
def FastAppendBFloat16ArrayToTensorProto(tensor_proto, proto_values):
- fast_tensor_util.AppendBFloat16ArrayToTensorProto(tensor_proto, np.asarray(proto_values, dtype=dtypes.bfloat16.as_numpy_dtype).view(np.uint16))
+ fast_tensor_util.AppendBFloat16ArrayToTensorProto(
+ tensor_proto, np.asarray(
+ proto_values, dtype=dtypes.bfloat16.as_numpy_dtype).view(np.uint16))
if _FAST_TENSOR_UTIL_AVAILABLE:
--
GitLab
From f2e22502fd58e8d81c9e080b9242375fbf2bc772 Mon Sep 17 00:00:00 2001
From: Jesse
Date: Tue, 5 Jun 2018 14:35:38 +0200
Subject: [PATCH 007/519] Updated line for creating global step + grammar
tf.train.get_global_step() returns None if there is no global step, preventing the pruning from working. Therefore, tf.train.get_or_create_global_step() is a safer option.
---
tensorflow/contrib/model_pruning/README.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tensorflow/contrib/model_pruning/README.md b/tensorflow/contrib/model_pruning/README.md
index 86f4fd6adf..50e7e5d7cd 100644
--- a/tensorflow/contrib/model_pruning/README.md
+++ b/tensorflow/contrib/model_pruning/README.md
@@ -66,10 +66,10 @@ is the sparsity_function_begin_step. In this equation, the
sparsity_function_exponent is set to 3.
### Adding pruning ops to the training graph
-The final step involves adding ops to the training graph that monitors the
-distribution of the layer's weight magnitudes and determines the layer threshold
-such masking all the weights below this threshold achieves the sparsity level
-desired for the current training step. This can be achieved as follows:
+The final step involves adding ops to the training graph that monitor the
+distribution of the layer's weight magnitudes and determine the layer threshold,
+such that masking all the weights below this threshold achieves the sparsity
+level desired for the current training step. This can be achieved as follows:
```python
tf.app.flags.DEFINE_string(
@@ -79,7 +79,7 @@ tf.app.flags.DEFINE_string(
with tf.graph.as_default():
# Create global step variable
- global_step = tf.train.get_global_step()
+ global_step = tf.train.get_or_create_global_step()
# Parse pruning hyperparameters
pruning_hparams = pruning.get_pruning_hparams().parse(FLAGS.pruning_hparams)
--
GitLab
From f9c7fe82cb930ee26d281e4bf21211ed352d176e Mon Sep 17 00:00:00 2001
From: Jesse
Date: Tue, 5 Jun 2018 14:49:04 +0200
Subject: [PATCH 008/519] Put some emphasis on incrementing global step
Pruning will not work if the global step is not incremented
---
tensorflow/contrib/model_pruning/README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/tensorflow/contrib/model_pruning/README.md b/tensorflow/contrib/model_pruning/README.md
index 50e7e5d7cd..9143d082bf 100644
--- a/tensorflow/contrib/model_pruning/README.md
+++ b/tensorflow/contrib/model_pruning/README.md
@@ -103,6 +103,7 @@ with tf.graph.as_default():
mon_sess.run(mask_update_op)
```
+Ensure that `global_step` is being [incremented](https://www.tensorflow.org/api_docs/python/tf/train/Optimizer#minimize), otherwise pruning will not work!
## Example: Pruning and training deep CNNs on the cifar10 dataset
--
GitLab
From e106a458dd26db58c7d5abbd4afef60f8ce33252 Mon Sep 17 00:00:00 2001
From: Jesse
Date: Tue, 5 Jun 2018 15:22:07 +0200
Subject: [PATCH 009/519] Prevent redundant ":0" in summary names
Take identical approach as is done with thresholds: using tf.Variable.op.name instead of tf.Variable.name, to prevent TensorFlow saying summary names are illegal (due to ":")
---
tensorflow/contrib/model_pruning/python/pruning.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tensorflow/contrib/model_pruning/python/pruning.py b/tensorflow/contrib/model_pruning/python/pruning.py
index 4b7af18b33..e6f9acc139 100644
--- a/tensorflow/contrib/model_pruning/python/pruning.py
+++ b/tensorflow/contrib/model_pruning/python/pruning.py
@@ -520,7 +520,7 @@ class Pruning(object):
thresholds = get_thresholds()
for index, mask in enumerate(masks):
if not self._exists_in_do_not_prune_list(mask.name):
- summary.scalar(mask.name + '/sparsity', nn_impl.zero_fraction(mask))
+ summary.scalar(mask.op.name + '/sparsity', nn_impl.zero_fraction(mask))
summary.scalar(thresholds[index].op.name + '/threshold',
thresholds[index])
--
GitLab
From 90b28b7316edb644b71b01edaaa8553d5913fc19 Mon Sep 17 00:00:00 2001
From: Jesse
Date: Wed, 6 Jun 2018 16:07:20 +0200
Subject: [PATCH 010/519] Removed redundant use of enumeration
Since every mask has an accompanying threshold, zip(masks, thresholds) can be used instead of enumerate(masks) and calling thresholds by index.
---
tensorflow/contrib/model_pruning/python/pruning.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tensorflow/contrib/model_pruning/python/pruning.py b/tensorflow/contrib/model_pruning/python/pruning.py
index e6f9acc139..d843fa26d5 100644
--- a/tensorflow/contrib/model_pruning/python/pruning.py
+++ b/tensorflow/contrib/model_pruning/python/pruning.py
@@ -518,11 +518,10 @@ class Pruning(object):
summary.scalar('last_mask_update_step', self._last_update_step)
masks = get_masks()
thresholds = get_thresholds()
- for index, mask in enumerate(masks):
+ for mask, threshold in zip(masks, thresholds):
if not self._exists_in_do_not_prune_list(mask.name):
summary.scalar(mask.op.name + '/sparsity', nn_impl.zero_fraction(mask))
- summary.scalar(thresholds[index].op.name + '/threshold',
- thresholds[index])
+ summary.scalar(threshold.op.name + '/threshold', threshold)
def print_hparams(self):
logging.info(self._spec.to_json())
--
GitLab
From 02b7fa3dfe3e82ca61581bf3365788c8acaa2b19 Mon Sep 17 00:00:00 2001
From: Amit Patankar
Date: Wed, 6 Jun 2018 14:04:40 -0700
Subject: [PATCH 011/519] Adding a constraint for the setuptools version.
---
tensorflow/tools/pip_package/setup.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py
index 78d955c637..97f625e7e9 100644
--- a/tensorflow/tools/pip_package/setup.py
+++ b/tensorflow/tools/pip_package/setup.py
@@ -54,6 +54,7 @@ REQUIRED_PACKAGES = [
'numpy >= 1.13.3',
'six >= 1.10.0',
'protobuf >= 3.4.0',
+ 'setuptools <= 39.1.0',
'tensorboard >= 1.8.0, < 1.9.0',
'termcolor >= 1.1.0',
]
--
GitLab
From da3f4f86267a42f1a7780222143d79b167a75eb1 Mon Sep 17 00:00:00 2001
From: Amit Patankar
Date: Wed, 6 Jun 2018 14:27:59 -0700
Subject: [PATCH 012/519] Removing the force downgrade install.
---
tensorflow/tools/ci_build/builds/pip.sh | 4 ----
1 file changed, 4 deletions(-)
diff --git a/tensorflow/tools/ci_build/builds/pip.sh b/tensorflow/tools/ci_build/builds/pip.sh
index 883bb93647..5fa75e1d61 100755
--- a/tensorflow/tools/ci_build/builds/pip.sh
+++ b/tensorflow/tools/ci_build/builds/pip.sh
@@ -322,10 +322,6 @@ create_activate_virtualenv_and_install_tensorflow() {
pip install -v ${PIP_FLAGS} ${WHL_PATH} || \
die "pip install (forcing to reinstall tensorflow) FAILED"
echo "Successfully installed pip package ${TF_WHEEL_PATH}"
-
- # Force downgrade setuptools.
- pip install --upgrade setuptools==39.1.0
-
}
################################################################################
--
GitLab
From 60cb7f88afda606df2b700ce0bb662f22e1a7709 Mon Sep 17 00:00:00 2001
From: Derek Murray
Date: Thu, 7 Jun 2018 12:53:11 -0700
Subject: [PATCH 013/519] Consolidate `tf.data` release notes.
---
RELEASE.md | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/RELEASE.md b/RELEASE.md
index c1ed69bd45..8f76e7efb4 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -14,8 +14,13 @@
## Bug Fixes and Other Changes
* `tf.data`:
- * The `DatasetBase::DebugString()` method is now `const`.
- * Added the `tf.contrib.data.sample_from_datasets()` API for randomly sampling from multiple datasets.
+ * `Dataset.from_generator()` now accepts an `args` list, in order to create nested generators.
+ * `Dataset.list_files()` now produces determinstic results when `shuffle=False` or a `seed` is passed.
+ * `tf.contrib.data.sample_from_datasets()` and `tf.contrib.data.choose_from_datasets()` make it easier to sample or deterministically choose elements from multiple datasets.
+ * `tf.contrib.data.make_csv_dataset()` now supports line breaks in quoted strings, and two infrequently used arguments removed.
+ * (C++) `DatasetBase::DebugString()` is now `const`.
+ * (C++) `DatasetBase::MakeIterator()` has been renamed to `DatasetBase::MakeIteratorInternal()`.
+ * (C++) `IteratorBase::Initialize()` method was added to support raising errors during iterator construction.
* Eager Execution:
* `tf.keras`:
* Move Keras code out of _impl folder and remove API files.
@@ -24,8 +29,6 @@
* Accelerated Linear Algebra (XLA):
* TensorFlow Debugger (tfdbg) CLI:
* `tf.contrib`:
- * Add `tf.contrib.data.choose_from_datasets()`.
- * `tf.contrib.data.make_csv_dataset()` now supports line breaks in quoted strings. Two arguments were removed from `make_csv_dataset`.
* `tf.contrib.framework.zero_initializer` supports ResourceVariable.
* Adding "constrained_optimization" to tensorflow/contrib.
* Other:
@@ -35,7 +38,6 @@
* More consistent GcsFileSystem behavior for certain reads past EOF.
* Update benchmark for tf.scan to match ranges across eager and graph modes.
* Fixed bug in `tf.reduce_prod gradient` for complex dtypes.
- * Add optional `args` argument to `Dataset.from_generator()`.
* Allow the use of '.' in variables (e.g. "hparams.parse('a.b=1.0')"), which would previously raise an error. This will correspond to an attribute name with an embedded '.' symbol (e.g. 'a.b'), which can only be accessed indirectly (e.g. through getattr and setattr). To set this up the user will first need to explicitly add the variable to the hparam object (e.g. "hparams.add_hparam(name='a.b', value=0.0)").
* Benchmark for tf.scan in graph and eager modes.
* Added complex128 support to FFT, FFT2D, FFT3D, IFFT, IFFT2D, and IFFT3D.
@@ -45,7 +47,6 @@
* LinearOperator[1D,2D,3D]Circulant added to `tensorflow.linalg`.
* Conv3D, Conv3DBackpropInput, Conv3DBackpropFilter now supports arbitrary.
* Added `tf.train.Checkpoint` for reading/writing object-based checkpoints.
- * `Dataset.list_files()` now produces determinstic results when `shuffle=False` or a `seed` is passed.
* Added LinearOperatorKronecker, a dense-free implementation of the Kronecker Product.
* Allow LinearOperator to broadcast.
* SavedModelBuilder will now deduplicate asset names that point to files with the same basename and the same contents. Note that this may result in new asset files included in SavedModels in cases where assets with the same name but different contents were previously overwriting each other.
--
GitLab
From d3b482dadfa1b59ec04ee668ebd899e6bcb4b7b8 Mon Sep 17 00:00:00 2001
From: Shanqing Cai
Date: Fri, 8 Jun 2018 14:55:26 -0400
Subject: [PATCH 014/519] Update RELEASE.md (r1.9) for tfdbg and XLA
---
RELEASE.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/RELEASE.md b/RELEASE.md
index 8f76e7efb4..879ce6e440 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -26,8 +26,7 @@
* Move Keras code out of _impl folder and remove API files.
* `tf.keras.Model.save_weights` now saves in TensorFlow format by default.
* Enable dataset iterators to be passed to `tf.keras.Model` training/eval methods.
-* Accelerated Linear Algebra (XLA):
-* TensorFlow Debugger (tfdbg) CLI:
+* TensorFlow Debugger (tfdbg) CLI: fix an issue in which the TensorBoard Debugger Plugin could not handle total source file size exceeding gRPC message size limit (4 MB).
* `tf.contrib`:
* `tf.contrib.framework.zero_initializer` supports ResourceVariable.
* Adding "constrained_optimization" to tensorflow/contrib.
--
GitLab
From a08c8a79f3d0ea5a7fac74d8f5e9da5def89170b Mon Sep 17 00:00:00 2001
From: Mark Daoust
Date: Mon, 4 Jun 2018 11:11:06 -0700
Subject: [PATCH 015/519] Fix visibility for tf.keras.__version__
PiperOrigin-RevId: 199161696
---
tensorflow/python/keras/__init__.py | 4 ++++
tensorflow/python/keras/integration_test.py | 3 +++
2 files changed, 7 insertions(+)
diff --git a/tensorflow/python/keras/__init__.py b/tensorflow/python/keras/__init__.py
index 197f306097..3493069a5b 100644
--- a/tensorflow/python/keras/__init__.py
+++ b/tensorflow/python/keras/__init__.py
@@ -41,8 +41,12 @@ from tensorflow.python.keras.layers import Input
from tensorflow.python.keras.models import Model
from tensorflow.python.keras.models import Sequential
+from tensorflow.python.util.tf_export import tf_export
+
__version__ = '2.1.6-tf'
+tf_export('keras.__version__').export_constant(__name__, '__version__')
+
del absolute_import
del division
del print_function
diff --git a/tensorflow/python/keras/integration_test.py b/tensorflow/python/keras/integration_test.py
index 2e83544d97..2a05699407 100644
--- a/tensorflow/python/keras/integration_test.py
+++ b/tensorflow/python/keras/integration_test.py
@@ -29,6 +29,9 @@ from tensorflow.python.platform import test
class KerasIntegrationTest(test.TestCase):
+ def test_version(self):
+ self.assertTrue(keras.__version__.endswith('-tf'))
+
def test_vector_classification_sequential(self):
with self.test_session():
np.random.seed(1337)
--
GitLab
From 0eac1ebafc1e16e6440658d6b431998f3e682bbc Mon Sep 17 00:00:00 2001
From: Francois Chollet
Date: Mon, 4 Jun 2018 14:46:38 -0700
Subject: [PATCH 016/519] Add various missing aliases for symbols in tf.keras
submodules.
PiperOrigin-RevId: 199198086
---
tensorflow/python/keras/losses.py | 35 ++++++++++++---
tensorflow/python/ops/init_ops.py | 21 +++++----
...nsorflow.keras.initializers.constant.pbtxt | 18 ++++++++
...nsorflow.keras.initializers.identity.pbtxt | 18 ++++++++
...tensorflow.keras.initializers.normal.pbtxt | 18 ++++++++
.../tensorflow.keras.initializers.ones.pbtxt | 18 ++++++++
...orflow.keras.initializers.orthogonal.pbtxt | 18 ++++++++
.../tensorflow.keras.initializers.pbtxt | 40 +++++++++++++++++
...low.keras.initializers.random_normal.pbtxt | 18 ++++++++
...ow.keras.initializers.random_uniform.pbtxt | 18 ++++++++
....keras.initializers.truncated_normal.pbtxt | 18 ++++++++
...ensorflow.keras.initializers.uniform.pbtxt | 18 ++++++++
.../tensorflow.keras.initializers.zeros.pbtxt | 18 ++++++++
.../api/golden/tensorflow.keras.losses.pbtxt | 44 +++++++++++++++++++
.../api/golden/tensorflow.keras.metrics.pbtxt | 44 +++++++++++++++++++
15 files changed, 350 insertions(+), 14 deletions(-)
create mode 100644 tensorflow/tools/api/golden/tensorflow.keras.initializers.constant.pbtxt
create mode 100644 tensorflow/tools/api/golden/tensorflow.keras.initializers.identity.pbtxt
create mode 100644 tensorflow/tools/api/golden/tensorflow.keras.initializers.normal.pbtxt
create mode 100644 tensorflow/tools/api/golden/tensorflow.keras.initializers.ones.pbtxt
create mode 100644 tensorflow/tools/api/golden/tensorflow.keras.initializers.orthogonal.pbtxt
create mode 100644 tensorflow/tools/api/golden/tensorflow.keras.initializers.random_normal.pbtxt
create mode 100644 tensorflow/tools/api/golden/tensorflow.keras.initializers.random_uniform.pbtxt
create mode 100644 tensorflow/tools/api/golden/tensorflow.keras.initializers.truncated_normal.pbtxt
create mode 100644 tensorflow/tools/api/golden/tensorflow.keras.initializers.uniform.pbtxt
create mode 100644 tensorflow/tools/api/golden/tensorflow.keras.initializers.zeros.pbtxt
diff --git a/tensorflow/python/keras/losses.py b/tensorflow/python/keras/losses.py
index d82ebd9c31..9f548bfe04 100644
--- a/tensorflow/python/keras/losses.py
+++ b/tensorflow/python/keras/losses.py
@@ -30,19 +30,31 @@ from tensorflow.python.util.tf_export import tf_export
@tf_export('keras.metrics.mean_squared_error',
- 'keras.losses.mean_squared_error')
+ 'keras.metrics.mse',
+ 'keras.metrics.MSE',
+ 'keras.losses.mean_squared_error',
+ 'keras.losses.mse',
+ 'keras.losses.MSE')
def mean_squared_error(y_true, y_pred):
return K.mean(math_ops.square(y_pred - y_true), axis=-1)
@tf_export('keras.metrics.mean_absolute_error',
- 'keras.losses.mean_absolute_error')
+ 'keras.metrics.mae',
+ 'keras.metrics.MAE',
+ 'keras.losses.mean_absolute_error',
+ 'keras.losses.mae',
+ 'keras.losses.MAE')
def mean_absolute_error(y_true, y_pred):
return K.mean(math_ops.abs(y_pred - y_true), axis=-1)
@tf_export('keras.metrics.mean_absolute_percentage_error',
- 'keras.losses.mean_absolute_percentage_error')
+ 'keras.metrics.mape',
+ 'keras.metrics.MAPE',
+ 'keras.losses.mean_absolute_percentage_error',
+ 'keras.losses.mape',
+ 'keras.losses.MAPE')
def mean_absolute_percentage_error(y_true, y_pred):
diff = math_ops.abs(
(y_true - y_pred) / K.clip(math_ops.abs(y_true), K.epsilon(), None))
@@ -50,7 +62,11 @@ def mean_absolute_percentage_error(y_true, y_pred):
@tf_export('keras.metrics.mean_squared_logarithmic_error',
- 'keras.losses.mean_squared_logarithmic_error')
+ 'keras.metrics.msle',
+ 'keras.metrics.MSLE',
+ 'keras.losses.mean_squared_logarithmic_error',
+ 'keras.losses.msle',
+ 'keras.losses.MSLE')
def mean_squared_logarithmic_error(y_true, y_pred):
first_log = math_ops.log(K.clip(y_pred, K.epsilon(), None) + 1.)
second_log = math_ops.log(K.clip(y_true, K.epsilon(), None) + 1.)
@@ -117,7 +133,11 @@ def binary_crossentropy(y_true, y_pred):
@tf_export('keras.metrics.kullback_leibler_divergence',
- 'keras.losses.kullback_leibler_divergence')
+ 'keras.metrics.kld',
+ 'keras.metrics.KLD',
+ 'keras.losses.kullback_leibler_divergence',
+ 'keras.losses.kld',
+ 'keras.losses.KLD')
def kullback_leibler_divergence(y_true, y_pred):
y_true = K.clip(y_true, K.epsilon(), 1)
y_pred = K.clip(y_pred, K.epsilon(), 1)
@@ -129,7 +149,10 @@ def poisson(y_true, y_pred):
return K.mean(y_pred - y_true * math_ops.log(y_pred + K.epsilon()), axis=-1)
-@tf_export('keras.metrics.cosine_proximity', 'keras.losses.cosine_proximity')
+@tf_export('keras.metrics.cosine_proximity',
+ 'keras.metrics.cosine',
+ 'keras.losses.cosine_proximity',
+ 'keras.losses.cosine')
def cosine_proximity(y_true, y_pred):
y_true = nn.l2_normalize(y_true, axis=-1)
y_pred = nn.l2_normalize(y_pred, axis=-1)
diff --git a/tensorflow/python/ops/init_ops.py b/tensorflow/python/ops/init_ops.py
index 1f8d8dc4f3..2df230d470 100644
--- a/tensorflow/python/ops/init_ops.py
+++ b/tensorflow/python/ops/init_ops.py
@@ -86,7 +86,7 @@ class Initializer(object):
@tf_export("keras.initializers.Zeros", "initializers.zeros",
- "zeros_initializer")
+ "zeros_initializer", "keras.initializers.zeros")
class Zeros(Initializer):
"""Initializer that generates tensors initialized to 0."""
@@ -102,7 +102,8 @@ class Zeros(Initializer):
return {"dtype": self.dtype.name}
-@tf_export("keras.initializers.Ones", "initializers.ones", "ones_initializer")
+@tf_export("keras.initializers.Ones", "initializers.ones", "ones_initializer",
+ "keras.initializers.ones")
class Ones(Initializer):
"""Initializer that generates tensors initialized to 1."""
@@ -119,7 +120,7 @@ class Ones(Initializer):
@tf_export("keras.initializers.Constant", "initializers.constant",
- "constant_initializer")
+ "constant_initializer", "keras.initializers.constant")
class Constant(Initializer):
"""Initializer that generates tensors with constant values.
@@ -225,7 +226,8 @@ class Constant(Initializer):
@tf_export("keras.initializers.RandomUniform", "initializers.random_uniform",
- "random_uniform_initializer")
+ "random_uniform_initializer", "keras.initializers.uniform",
+ "keras.initializers.random_uniform")
class RandomUniform(Initializer):
"""Initializer that generates tensors with a uniform distribution.
@@ -262,7 +264,8 @@ class RandomUniform(Initializer):
@tf_export("keras.initializers.RandomNormal", "initializers.random_normal",
- "random_normal_initializer")
+ "random_normal_initializer", "keras.initializers.normal",
+ "keras.initializers.random_normal")
class RandomNormal(Initializer):
"""Initializer that generates tensors with a normal distribution.
@@ -299,7 +302,8 @@ class RandomNormal(Initializer):
@tf_export("keras.initializers.TruncatedNormal",
- "initializers.truncated_normal", "truncated_normal_initializer")
+ "initializers.truncated_normal", "truncated_normal_initializer",
+ "keras.initializers.truncated_normal")
class TruncatedNormal(Initializer):
"""Initializer that generates a truncated normal distribution.
@@ -482,7 +486,7 @@ class VarianceScaling(Initializer):
@tf_export("keras.initializers.Orthogonal", "initializers.orthogonal",
- "orthogonal_initializer")
+ "orthogonal_initializer", "keras.initializers.orthogonal")
class Orthogonal(Initializer):
"""Initializer that generates an orthogonal matrix.
@@ -1062,7 +1066,8 @@ class ConvolutionOrthogonal3D(ConvolutionOrthogonal):
return self._dict_to_tensor(p, ksize, ksize, ksize)
-@tf_export("keras.initializers.Identity", "initializers.identity")
+@tf_export("keras.initializers.Identity", "initializers.identity",
+ "keras.initializers.identity")
class Identity(Initializer):
"""Initializer that generates the identity matrix.
diff --git a/tensorflow/tools/api/golden/tensorflow.keras.initializers.constant.pbtxt b/tensorflow/tools/api/golden/tensorflow.keras.initializers.constant.pbtxt
new file mode 100644
index 0000000000..bddc37b907
--- /dev/null
+++ b/tensorflow/tools/api/golden/tensorflow.keras.initializers.constant.pbtxt
@@ -0,0 +1,18 @@
+path: "tensorflow.keras.initializers.constant"
+tf_class {
+ is_instance: ""
+ is_instance: ""
+ is_instance: ""
+ member_method {
+ name: "__init__"
+ argspec: "args=[\'self\', \'value\', \'dtype\', \'verify_shape\'], varargs=None, keywords=None, defaults=[\'0\', \"\", \'False\'], "
+ }
+ member_method {
+ name: "from_config"
+ argspec: "args=[\'cls\', \'config\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "get_config"
+ argspec: "args=[\'self\'], varargs=None, keywords=None, defaults=None"
+ }
+}
diff --git a/tensorflow/tools/api/golden/tensorflow.keras.initializers.identity.pbtxt b/tensorflow/tools/api/golden/tensorflow.keras.initializers.identity.pbtxt
new file mode 100644
index 0000000000..a4c5a61490
--- /dev/null
+++ b/tensorflow/tools/api/golden/tensorflow.keras.initializers.identity.pbtxt
@@ -0,0 +1,18 @@
+path: "tensorflow.keras.initializers.identity"
+tf_class {
+ is_instance: ""
+ is_instance: ""
+ is_instance: ""
+ member_method {
+ name: "__init__"
+ argspec: "args=[\'self\', \'gain\', \'dtype\'], varargs=None, keywords=None, defaults=[\'1.0\', \"\"], "
+ }
+ member_method {
+ name: "from_config"
+ argspec: "args=[\'cls\', \'config\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "get_config"
+ argspec: "args=[\'self\'], varargs=None, keywords=None, defaults=None"
+ }
+}
diff --git a/tensorflow/tools/api/golden/tensorflow.keras.initializers.normal.pbtxt b/tensorflow/tools/api/golden/tensorflow.keras.initializers.normal.pbtxt
new file mode 100644
index 0000000000..7485772784
--- /dev/null
+++ b/tensorflow/tools/api/golden/tensorflow.keras.initializers.normal.pbtxt
@@ -0,0 +1,18 @@
+path: "tensorflow.keras.initializers.normal"
+tf_class {
+ is_instance: ""
+ is_instance: ""
+ is_instance: ""
+ member_method {
+ name: "__init__"
+ argspec: "args=[\'self\', \'mean\', \'stddev\', \'seed\', \'dtype\'], varargs=None, keywords=None, defaults=[\'0.0\', \'1.0\', \'None\', \"\"], "
+ }
+ member_method {
+ name: "from_config"
+ argspec: "args=[\'cls\', \'config\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "get_config"
+ argspec: "args=[\'self\'], varargs=None, keywords=None, defaults=None"
+ }
+}
diff --git a/tensorflow/tools/api/golden/tensorflow.keras.initializers.ones.pbtxt b/tensorflow/tools/api/golden/tensorflow.keras.initializers.ones.pbtxt
new file mode 100644
index 0000000000..a89f78d1e1
--- /dev/null
+++ b/tensorflow/tools/api/golden/tensorflow.keras.initializers.ones.pbtxt
@@ -0,0 +1,18 @@
+path: "tensorflow.keras.initializers.ones"
+tf_class {
+ is_instance: ""
+ is_instance: ""
+ is_instance: ""
+ member_method {
+ name: "__init__"
+ argspec: "args=[\'self\', \'dtype\'], varargs=None, keywords=None, defaults=[\"\"], "
+ }
+ member_method {
+ name: "from_config"
+ argspec: "args=[\'cls\', \'config\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "get_config"
+ argspec: "args=[\'self\'], varargs=None, keywords=None, defaults=None"
+ }
+}
diff --git a/tensorflow/tools/api/golden/tensorflow.keras.initializers.orthogonal.pbtxt b/tensorflow/tools/api/golden/tensorflow.keras.initializers.orthogonal.pbtxt
new file mode 100644
index 0000000000..ee1e9bbae2
--- /dev/null
+++ b/tensorflow/tools/api/golden/tensorflow.keras.initializers.orthogonal.pbtxt
@@ -0,0 +1,18 @@
+path: "tensorflow.keras.initializers.orthogonal"
+tf_class {
+ is_instance: ""
+ is_instance: ""
+ is_instance: ""
+ member_method {
+ name: "__init__"
+ argspec: "args=[\'self\', \'gain\', \'seed\', \'dtype\'], varargs=None, keywords=None, defaults=[\'1.0\', \'None\', \"\"], "
+ }
+ member_method {
+ name: "from_config"
+ argspec: "args=[\'cls\', \'config\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "get_config"
+ argspec: "args=[\'self\'], varargs=None, keywords=None, defaults=None"
+ }
+}
diff --git a/tensorflow/tools/api/golden/tensorflow.keras.initializers.pbtxt b/tensorflow/tools/api/golden/tensorflow.keras.initializers.pbtxt
index 093c56595b..14a667870d 100644
--- a/tensorflow/tools/api/golden/tensorflow.keras.initializers.pbtxt
+++ b/tensorflow/tools/api/golden/tensorflow.keras.initializers.pbtxt
@@ -40,6 +40,46 @@ tf_module {
name: "Zeros"
mtype: ""
}
+ member {
+ name: "constant"
+ mtype: ""
+ }
+ member {
+ name: "identity"
+ mtype: ""
+ }
+ member {
+ name: "normal"
+ mtype: ""
+ }
+ member {
+ name: "ones"
+ mtype: ""
+ }
+ member {
+ name: "orthogonal"
+ mtype: ""
+ }
+ member {
+ name: "random_normal"
+ mtype: ""
+ }
+ member {
+ name: "random_uniform"
+ mtype: ""
+ }
+ member {
+ name: "truncated_normal"
+ mtype: ""
+ }
+ member {
+ name: "uniform"
+ mtype: ""
+ }
+ member {
+ name: "zeros"
+ mtype: ""
+ }
member_method {
name: "deserialize"
argspec: "args=[\'config\', \'custom_objects\'], varargs=None, keywords=None, defaults=[\'None\'], "
diff --git a/tensorflow/tools/api/golden/tensorflow.keras.initializers.random_normal.pbtxt b/tensorflow/tools/api/golden/tensorflow.keras.initializers.random_normal.pbtxt
new file mode 100644
index 0000000000..a6df1e87a3
--- /dev/null
+++ b/tensorflow/tools/api/golden/tensorflow.keras.initializers.random_normal.pbtxt
@@ -0,0 +1,18 @@
+path: "tensorflow.keras.initializers.random_normal"
+tf_class {
+ is_instance: ""
+ is_instance: ""
+ is_instance: ""
+ member_method {
+ name: "__init__"
+ argspec: "args=[\'self\', \'mean\', \'stddev\', \'seed\', \'dtype\'], varargs=None, keywords=None, defaults=[\'0.0\', \'1.0\', \'None\', \"\"], "
+ }
+ member_method {
+ name: "from_config"
+ argspec: "args=[\'cls\', \'config\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "get_config"
+ argspec: "args=[\'self\'], varargs=None, keywords=None, defaults=None"
+ }
+}
diff --git a/tensorflow/tools/api/golden/tensorflow.keras.initializers.random_uniform.pbtxt b/tensorflow/tools/api/golden/tensorflow.keras.initializers.random_uniform.pbtxt
new file mode 100644
index 0000000000..37a0fa0d55
--- /dev/null
+++ b/tensorflow/tools/api/golden/tensorflow.keras.initializers.random_uniform.pbtxt
@@ -0,0 +1,18 @@
+path: "tensorflow.keras.initializers.random_uniform"
+tf_class {
+ is_instance: ""
+ is_instance: ""
+ is_instance: ""
+ member_method {
+ name: "__init__"
+ argspec: "args=[\'self\', \'minval\', \'maxval\', \'seed\', \'dtype\'], varargs=None, keywords=None, defaults=[\'0\', \'None\', \'None\', \"\"], "
+ }
+ member_method {
+ name: "from_config"
+ argspec: "args=[\'cls\', \'config\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "get_config"
+ argspec: "args=[\'self\'], varargs=None, keywords=None, defaults=None"
+ }
+}
diff --git a/tensorflow/tools/api/golden/tensorflow.keras.initializers.truncated_normal.pbtxt b/tensorflow/tools/api/golden/tensorflow.keras.initializers.truncated_normal.pbtxt
new file mode 100644
index 0000000000..f97e93f0b7
--- /dev/null
+++ b/tensorflow/tools/api/golden/tensorflow.keras.initializers.truncated_normal.pbtxt
@@ -0,0 +1,18 @@
+path: "tensorflow.keras.initializers.truncated_normal"
+tf_class {
+ is_instance: ""
+ is_instance: ""
+ is_instance: ""
+ member_method {
+ name: "__init__"
+ argspec: "args=[\'self\', \'mean\', \'stddev\', \'seed\', \'dtype\'], varargs=None, keywords=None, defaults=[\'0.0\', \'1.0\', \'None\', \"\"], "
+ }
+ member_method {
+ name: "from_config"
+ argspec: "args=[\'cls\', \'config\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "get_config"
+ argspec: "args=[\'self\'], varargs=None, keywords=None, defaults=None"
+ }
+}
diff --git a/tensorflow/tools/api/golden/tensorflow.keras.initializers.uniform.pbtxt b/tensorflow/tools/api/golden/tensorflow.keras.initializers.uniform.pbtxt
new file mode 100644
index 0000000000..58186b1383
--- /dev/null
+++ b/tensorflow/tools/api/golden/tensorflow.keras.initializers.uniform.pbtxt
@@ -0,0 +1,18 @@
+path: "tensorflow.keras.initializers.uniform"
+tf_class {
+ is_instance: ""
+ is_instance: ""
+ is_instance: ""
+ member_method {
+ name: "__init__"
+ argspec: "args=[\'self\', \'minval\', \'maxval\', \'seed\', \'dtype\'], varargs=None, keywords=None, defaults=[\'0\', \'None\', \'None\', \"\"], "
+ }
+ member_method {
+ name: "from_config"
+ argspec: "args=[\'cls\', \'config\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "get_config"
+ argspec: "args=[\'self\'], varargs=None, keywords=None, defaults=None"
+ }
+}
diff --git a/tensorflow/tools/api/golden/tensorflow.keras.initializers.zeros.pbtxt b/tensorflow/tools/api/golden/tensorflow.keras.initializers.zeros.pbtxt
new file mode 100644
index 0000000000..a262390687
--- /dev/null
+++ b/tensorflow/tools/api/golden/tensorflow.keras.initializers.zeros.pbtxt
@@ -0,0 +1,18 @@
+path: "tensorflow.keras.initializers.zeros"
+tf_class {
+ is_instance: ""
+ is_instance: ""
+ is_instance: ""
+ member_method {
+ name: "__init__"
+ argspec: "args=[\'self\', \'dtype\'], varargs=None, keywords=None, defaults=[\"\"], "
+ }
+ member_method {
+ name: "from_config"
+ argspec: "args=[\'cls\', \'config\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "get_config"
+ argspec: "args=[\'self\'], varargs=None, keywords=None, defaults=None"
+ }
+}
diff --git a/tensorflow/tools/api/golden/tensorflow.keras.losses.pbtxt b/tensorflow/tools/api/golden/tensorflow.keras.losses.pbtxt
index ae5f6305b7..eca6b91538 100644
--- a/tensorflow/tools/api/golden/tensorflow.keras.losses.pbtxt
+++ b/tensorflow/tools/api/golden/tensorflow.keras.losses.pbtxt
@@ -1,5 +1,25 @@
path: "tensorflow.keras.losses"
tf_module {
+ member_method {
+ name: "KLD"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "MAE"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "MAPE"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "MSE"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "MSLE"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
member_method {
name: "binary_crossentropy"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
@@ -12,6 +32,10 @@ tf_module {
name: "categorical_hinge"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
}
+ member_method {
+ name: "cosine"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
member_method {
name: "cosine_proximity"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
@@ -28,6 +52,10 @@ tf_module {
name: "hinge"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
}
+ member_method {
+ name: "kld"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
member_method {
name: "kullback_leibler_divergence"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
@@ -36,6 +64,14 @@ tf_module {
name: "logcosh"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
}
+ member_method {
+ name: "mae"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "mape"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
member_method {
name: "mean_absolute_error"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
@@ -52,6 +88,14 @@ tf_module {
name: "mean_squared_logarithmic_error"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
}
+ member_method {
+ name: "mse"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "msle"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
member_method {
name: "poisson"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
diff --git a/tensorflow/tools/api/golden/tensorflow.keras.metrics.pbtxt b/tensorflow/tools/api/golden/tensorflow.keras.metrics.pbtxt
index 42729e4237..a97a9b5758 100644
--- a/tensorflow/tools/api/golden/tensorflow.keras.metrics.pbtxt
+++ b/tensorflow/tools/api/golden/tensorflow.keras.metrics.pbtxt
@@ -1,5 +1,25 @@
path: "tensorflow.keras.metrics"
tf_module {
+ member_method {
+ name: "KLD"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "MAE"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "MAPE"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "MSE"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "MSLE"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
member_method {
name: "binary_accuracy"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
@@ -16,6 +36,10 @@ tf_module {
name: "categorical_crossentropy"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
}
+ member_method {
+ name: "cosine"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
member_method {
name: "cosine_proximity"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
@@ -32,10 +56,22 @@ tf_module {
name: "hinge"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
}
+ member_method {
+ name: "kld"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
member_method {
name: "kullback_leibler_divergence"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
}
+ member_method {
+ name: "mae"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "mape"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
member_method {
name: "mean_absolute_error"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
@@ -52,6 +88,14 @@ tf_module {
name: "mean_squared_logarithmic_error"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
}
+ member_method {
+ name: "mse"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
+ member_method {
+ name: "msle"
+ argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
+ }
member_method {
name: "poisson"
argspec: "args=[\'y_true\', \'y_pred\'], varargs=None, keywords=None, defaults=None"
--
GitLab
From 7c33a7751d77cfd70a5c441da369440f4f6b633a Mon Sep 17 00:00:00 2001
From: Pavithra Vijay
Date: Thu, 7 Jun 2018 09:20:57 -0700
Subject: [PATCH 017/519] Fix bug due to incorrect nesting of return statement
in eager iterator evaluation.
PiperOrigin-RevId: 199645638
---
.../python/keras/engine/training_eager.py | 10 ++--
.../keras/engine/training_eager_test.py | 54 +++++++++++++++++++
2 files changed, 59 insertions(+), 5 deletions(-)
diff --git a/tensorflow/python/keras/engine/training_eager.py b/tensorflow/python/keras/engine/training_eager.py
index 081e46aa66..a70b488f25 100644
--- a/tensorflow/python/keras/engine/training_eager.py
+++ b/tensorflow/python/keras/engine/training_eager.py
@@ -501,11 +501,11 @@ def iterator_test_loop(model, inputs, steps, verbose=0):
if verbose == 1:
progbar.update(step_index + 1)
- for i in range(len(outs)):
- outs[i] /= num_samples
- if len(outs) == 1:
- return outs[0]
- return outs
+ for i in range(len(outs)):
+ outs[i] /= num_samples
+ if len(outs) == 1:
+ return outs[0]
+ return outs
def batch_test_loop(model,
diff --git a/tensorflow/python/keras/engine/training_eager_test.py b/tensorflow/python/keras/engine/training_eager_test.py
index d9446fd437..7906d208eb 100644
--- a/tensorflow/python/keras/engine/training_eager_test.py
+++ b/tensorflow/python/keras/engine/training_eager_test.py
@@ -20,6 +20,7 @@ from __future__ import print_function
import numpy as np
+from tensorflow.python.data.ops import dataset_ops
from tensorflow.python import keras
from tensorflow.python.framework import ops
from tensorflow.python.framework import test_util as tf_test_util
@@ -670,6 +671,59 @@ class CorrectnessTest(test.TestCase):
outs = model.evaluate(x, y)
self.assertEqual(outs[1], 0.)
+ @tf_test_util.run_in_graph_and_eager_modes()
+ def test_loss_correctness_with_iterator(self):
+ # Test that training loss is the same in eager and graph
+ # (by comparing it to a reference value in a deterministic case)
+ model = keras.Sequential()
+ model.add(
+ keras.layers.Dense(
+ 3, activation='relu', input_dim=4, kernel_initializer='ones'))
+ model.add(
+ keras.layers.Dense(2, activation='softmax', kernel_initializer='ones'))
+ model.compile(
+ loss='sparse_categorical_crossentropy',
+ optimizer=RMSPropOptimizer(learning_rate=0.001))
+ x = np.ones((100, 4), dtype=np.float32)
+ np.random.seed(123)
+ y = np.random.randint(0, 1, size=(100, 1))
+ dataset = dataset_ops.Dataset.from_tensor_slices((x, y))
+ dataset = dataset.repeat(100)
+ dataset = dataset.batch(10)
+ iterator = dataset.make_one_shot_iterator()
+ history = model.fit(iterator, epochs=1, steps_per_epoch=10)
+ self.assertEqual(np.around(history.history['loss'][-1], decimals=4), 0.6173)
+
+ @tf_test_util.run_in_graph_and_eager_modes()
+ def test_metrics_correctness_with_iterator(self):
+ model = keras.Sequential()
+ model.add(
+ keras.layers.Dense(
+ 8, activation='relu', input_dim=4, kernel_initializer='ones'))
+ model.add(
+ keras.layers.Dense(1, activation='sigmoid', kernel_initializer='ones'))
+ model.compile(
+ loss='binary_crossentropy',
+ metrics=['accuracy'],
+ optimizer=RMSPropOptimizer(learning_rate=0.001))
+ np.random.seed(123)
+ x = np.random.randint(10, size=(100, 4)).astype(np.float32)
+ y = np.random.randint(2, size=(100, 1)).astype(np.float32)
+ dataset = dataset_ops.Dataset.from_tensor_slices((x, y))
+ dataset = dataset.batch(10)
+ iterator = dataset.make_one_shot_iterator()
+ outs = model.evaluate(iterator, steps=10)
+ self.assertEqual(np.around(outs[1], decimals=1), 0.5)
+
+ y = np.zeros((100, 1), dtype=np.float32)
+ dataset = dataset_ops.Dataset.from_tensor_slices((x, y))
+ dataset = dataset.repeat(100)
+ dataset = dataset.batch(10)
+ iterator = dataset.make_one_shot_iterator()
+ outs = model.evaluate(iterator, steps=10)
+ self.assertEqual(outs[1], 0.)
+
+
if __name__ == '__main__':
ops.enable_eager_execution()
test.main()
--
GitLab
From 5177fd2f9acb9b46b9182ad782bb8b7b9386baeb Mon Sep 17 00:00:00 2001
From: "A. Unique TensorFlower"
Date: Tue, 5 Jun 2018 15:59:21 -0700
Subject: [PATCH 018/519] Only calls compare function if values were read from
event file
PiperOrigin-RevId: 199373169
---
tensorflow/python/estimator/exporter.py | 7 ++--
tensorflow/python/estimator/exporter_test.py | 34 ++++++++++++++++++++
2 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/tensorflow/python/estimator/exporter.py b/tensorflow/python/estimator/exporter.py
index a7212bb83e..766ea23f2a 100644
--- a/tensorflow/python/estimator/exporter.py
+++ b/tensorflow/python/estimator/exporter.py
@@ -360,9 +360,10 @@ class BestExporter(Exporter):
for value in event.summary.value:
if value.HasField('simple_value'):
event_eval_result[value.tag] = value.simple_value
- if best_eval_result is None or self._compare_fn(
- best_eval_result, event_eval_result):
- best_eval_result = event_eval_result
+ if event_eval_result:
+ if best_eval_result is None or self._compare_fn(
+ best_eval_result, event_eval_result):
+ best_eval_result = event_eval_result
return best_eval_result
diff --git a/tensorflow/python/estimator/exporter_test.py b/tensorflow/python/estimator/exporter_test.py
index 4cb4bffc8d..c4b006955c 100644
--- a/tensorflow/python/estimator/exporter_test.py
+++ b/tensorflow/python/estimator/exporter_test.py
@@ -148,6 +148,40 @@ class BestExporterTest(test.TestCase):
"checkpoint_path", {"loss": 20}, False)
self.assertEqual(None, export_result)
+ def test_best_exporter_with_empty_event(self):
+
+ def _serving_input_receiver_fn():
+ pass
+
+ export_dir_base = tempfile.mkdtemp()
+ gfile.MkDir(export_dir_base)
+ gfile.MkDir(export_dir_base + "/export")
+ gfile.MkDir(export_dir_base + "/eval")
+
+ eval_dir_base = os.path.join(export_dir_base, "eval_continuous")
+ estimator_lib._write_dict_to_summary(eval_dir_base, {}, 1)
+ estimator_lib._write_dict_to_summary(eval_dir_base, {"loss": 60}, 2)
+
+ exporter = exporter_lib.BestExporter(
+ name="best_exporter",
+ serving_input_receiver_fn=_serving_input_receiver_fn,
+ event_file_pattern="eval_continuous/*.tfevents.*",
+ assets_extra={"from/path": "to/path"},
+ as_text=False,
+ exports_to_keep=1)
+
+ estimator = test.mock.Mock(spec=estimator_lib.Estimator)
+ estimator.model_dir = export_dir_base
+ estimator.export_savedmodel.return_value = "export_result_path"
+
+ export_result = exporter.export(estimator, export_dir_base,
+ "checkpoint_path", {"loss": 100}, False)
+ self.assertEqual(None, export_result)
+
+ export_result = exporter.export(estimator, export_dir_base,
+ "checkpoint_path", {"loss": 10}, False)
+ self.assertEqual("export_result_path", export_result)
+
def test_garbage_collect_exports(self):
export_dir_base = tempfile.mkdtemp()
gfile.MkDir(export_dir_base)
--
GitLab
From 4fe8d4a14936dc38558a858283574993909c9895 Mon Sep 17 00:00:00 2001
From: "A. Unique TensorFlower"
Date: Sun, 27 May 2018 10:49:12 -0700
Subject: [PATCH 019/519] TPUEstimator.export_savedmodel() saves a SavedModel
with both TPU and CPU graphs.
PiperOrigin-RevId: 198229550
---
tensorflow/contrib/tpu/python/tpu/tpu_estimator.py | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py b/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py
index 4465833f88..c8c08a5a63 100644
--- a/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py
+++ b/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py
@@ -1807,7 +1807,7 @@ class TPUEstimator(estimator_lib.Estimator):
export_outputs['classes'] =
export_output_lib.ClassificationOutput(classes=classes)
- tpu.outside_compilation(host_call, logits)
+ tpu.outside_compilation(host_call, [logits])
...
```
@@ -1969,7 +1969,7 @@ class TPUEstimator(estimator_lib.Estimator):
input_receiver_fn_map[mode]}
export_tags = [tag_constants.SERVING, tag_constants.TPU]
mode = _REWRITE_FOR_INFERENCE_MODE
- try:
+ if self._export_to_tpu:
(super(TPUEstimator, self).
_add_meta_graph_for_mode(builder,
input_receiver_fn_map,
@@ -1978,9 +1978,6 @@ class TPUEstimator(estimator_lib.Estimator):
save_variables=False,
mode=mode,
export_tags=export_tags))
- except Exception as error: # pylint: disable=broad-except
- logging.warning('Saving meta graph for TPU failed: {}.'
- .format(str(error)))
def _call_model_fn(self, features, labels, mode, config):
if mode == _REWRITE_FOR_INFERENCE_MODE:
--
GitLab
From 51ad43efe5d918e7c57bd6c612fc1d0efd0b0664 Mon Sep 17 00:00:00 2001
From: "A. Unique TensorFlower"
Date: Tue, 29 May 2018 14:28:59 -0700
Subject: [PATCH 020/519] In TPUEstimator.export_savedmodel(), if saving TPU
metegraph fails, issue a warning instead so that user can still use the CPU
metagraph.
PiperOrigin-RevId: 198458571
--
GitLab
From 982f3e3038f8d07964b2c58843a51bd9745a8990 Mon Sep 17 00:00:00 2001
From: "A. Unique TensorFlower"
Date: Fri, 1 Jun 2018 16:32:20 -0700
Subject: [PATCH 021/519] Allow user to opt out of saving metagraph for TPU
with TPUEstimator.export_output().
PiperOrigin-RevId: 198944144
---
tensorflow/contrib/tpu/python/tpu/tpu_estimator.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py b/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py
index c8c08a5a63..7c770912b4 100644
--- a/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py
+++ b/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py
@@ -1830,6 +1830,7 @@ class TPUEstimator(estimator_lib.Estimator):
predict_batch_size=None,
batch_axis=None,
eval_on_tpu=True,
+ export_to_tpu=True,
warm_start_from=None):
"""Constructs an `TPUEstimator` instance.
@@ -1872,6 +1873,8 @@ class TPUEstimator(estimator_lib.Estimator):
False or `PER_HOST_V2`, batch_axis is ignored.
eval_on_tpu: If False, evaluation runs on CPU or GPU. In this case, the
model_fn must return `EstimatorSpec` when called with `mode` as `EVAL`.
+ export_to_tpu: If True, `export_savedmodel()` exports a metagraph for
+ serving on TPU besides the one on CPU.
warm_start_from: Optional string filepath to a checkpoint or SavedModel to
warm-start from, or a `tf.estimator.WarmStartSettings`
object to fully configure warm-starting. If the string
@@ -1943,6 +1946,8 @@ class TPUEstimator(estimator_lib.Estimator):
use_tpu,
eval_on_tpu)
+ self._export_to_tpu = export_to_tpu
+
self._is_input_fn_invoked = None
def _add_meta_graph_for_mode(self,
@@ -1965,11 +1970,11 @@ class TPUEstimator(estimator_lib.Estimator):
save_variables,
mode=mode)
- input_receiver_fn_map = {_REWRITE_FOR_INFERENCE_MODE:
- input_receiver_fn_map[mode]}
- export_tags = [tag_constants.SERVING, tag_constants.TPU]
- mode = _REWRITE_FOR_INFERENCE_MODE
if self._export_to_tpu:
+ input_receiver_fn_map = {_REWRITE_FOR_INFERENCE_MODE:
+ input_receiver_fn_map[mode]}
+ export_tags = [tag_constants.SERVING, tag_constants.TPU]
+ mode = _REWRITE_FOR_INFERENCE_MODE
(super(TPUEstimator, self).
_add_meta_graph_for_mode(builder,
input_receiver_fn_map,
--
GitLab
From 6cc2741eb1c9b19742b32b8edda39090afbf5abf Mon Sep 17 00:00:00 2001
From: DavidNorman
Date: Tue, 12 Jun 2018 09:32:53 +0100
Subject: [PATCH 022/519] Fix python lint errors
---
tensorflow/compiler/tests/binary_ops_test.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tensorflow/compiler/tests/binary_ops_test.py b/tensorflow/compiler/tests/binary_ops_test.py
index 64eeed8312..823afbbbdc 100644
--- a/tensorflow/compiler/tests/binary_ops_test.py
+++ b/tensorflow/compiler/tests/binary_ops_test.py
@@ -687,11 +687,12 @@ class BinaryOpsTest(XLATestCase):
np.float32(7),
expected=np.array([[False], [False], [True]], dtype=np.bool))
if np.int64 in self.numeric_types:
- self._testBinary(
- less_op,
- np.array([[10], [7], [2], [-1]], dtype=np.int64),
- np.int64(7),
- expected=np.array([[False], [False], [True], [True]], dtype=np.bool))
+ self._testBinary(
+ less_op,
+ np.array([[10], [7], [2], [-1]], dtype=np.int64),
+ np.int64(7),
+ expected=np.array(
+ [[False], [False], [True], [True]], dtype=np.bool))
for less_equal_op in [math_ops.less_equal, (lambda x, y: x <= y)]:
self._testBinary(
--
GitLab
From fd44596bc4b3ea8c67838b728b450a44e35c1b89 Mon Sep 17 00:00:00 2001
From: Anna R
Date: Mon, 11 Jun 2018 17:21:06 -0700
Subject: [PATCH 023/519] Merging
---
tensorflow/tools/api/generator/BUILD | 24 ++++++
.../tools/api/generator/create_python_api.py | 54 +++++++++++--
tensorflow/tools/api/generator/doc_srcs.py | 65 +++++++++++++++
.../tools/api/generator/doc_srcs_test.py | 80 +++++++++++++++++++
4 files changed, 217 insertions(+), 6 deletions(-)
create mode 100644 tensorflow/tools/api/generator/doc_srcs.py
create mode 100644 tensorflow/tools/api/generator/doc_srcs_test.py
diff --git a/tensorflow/tools/api/generator/BUILD b/tensorflow/tools/api/generator/BUILD
index f0c5877a90..3a28153e52 100644
--- a/tensorflow/tools/api/generator/BUILD
+++ b/tensorflow/tools/api/generator/BUILD
@@ -5,12 +5,21 @@ licenses(["notice"]) # Apache 2.0
exports_files(["LICENSE"])
+load("//tensorflow/tools/api/generator:api_gen.bzl", "TENSORFLOW_API_INIT_FILES")
+
+py_library(
+ name = "doc_srcs",
+ srcs = ["doc_srcs.py"],
+ srcs_version = "PY2AND3",
+)
+
py_binary(
name = "create_python_api",
srcs = ["create_python_api.py"],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
+ ":doc_srcs",
"//tensorflow/python:no_contrib",
],
)
@@ -24,3 +33,18 @@ py_test(
"//tensorflow/python:client_testlib",
],
)
+
+py_test(
+ name = "tensorflow_doc_srcs_test",
+ srcs = ["doc_srcs_test.py"],
+ args = [
+ "--package=tensorflow.python",
+ ] + TENSORFLOW_API_INIT_FILES,
+ main = "doc_srcs_test.py",
+ srcs_version = "PY2AND3",
+ deps = [
+ ":doc_srcs",
+ "//tensorflow/python:client_testlib",
+ "//tensorflow/python:no_contrib",
+ ],
+)
diff --git a/tensorflow/tools/api/generator/create_python_api.py b/tensorflow/tools/api/generator/create_python_api.py
index 9f210ad42b..31f287b7fe 100644
--- a/tensorflow/tools/api/generator/create_python_api.py
+++ b/tensorflow/tools/api/generator/create_python_api.py
@@ -25,6 +25,8 @@ import os
import sys
from tensorflow.python.util import tf_decorator
+from tensorflow.python.util import tf_export
+from tensorflow.tools.api.generator import doc_srcs
_API_CONSTANTS_ATTR = '_tf_api_constants'
@@ -36,10 +38,9 @@ _SYMBOLS_TO_SKIP_EXPLICITLY = {
# would have side effects.
'tensorflow.python.platform.flags.FLAGS'
}
-_GENERATED_FILE_HEADER = """\"\"\"Imports for Python API.
-
-This file is MACHINE GENERATED! Do not edit.
-Generated by: tensorflow/tools/api/generator/create_python_api.py script.
+_GENERATED_FILE_HEADER = """# This file is MACHINE GENERATED! Do not edit.
+# Generated by: tensorflow/tools/api/generator/create_python_api.py script.
+\"\"\"%s
\"\"\"
from __future__ import print_function
@@ -254,6 +255,44 @@ def get_module(dir_path, relative_to_dir):
return dir_path.replace('/', '.').strip('.')
+def get_module_docstring(module_name, package):
+ """Get docstring for the given module.
+
+ This method looks for docstring in the following order:
+ 1. Checks if module has a docstring specified in doc_srcs.
+ 2. Checks if module has a docstring source module specified
+ in doc_srcs. If it does, gets docstring from that module.
+ 3. Checks if module with module_name exists under base package.
+ If it does, gets docstring from that module.
+ 4. Returns a default docstring.
+
+ Args:
+ module_name: module name relative to tensorflow
+ (excluding 'tensorflow.' prefix) to get a docstring for.
+ package: Base python package containing python with target tf_export
+ decorators.
+
+ Returns:
+ One-line docstring to describe the module.
+ """
+ # Module under base package to get a docstring from.
+ docstring_module_name = module_name
+
+ if module_name in doc_srcs.TENSORFLOW_DOC_SOURCES:
+ docsrc = doc_srcs.TENSORFLOW_DOC_SOURCES[module_name]
+ if docsrc.docstring:
+ return docsrc.docstring
+ if docsrc.docstring_module_name:
+ docstring_module_name = docsrc.docstring_module_name
+
+ docstring_module_name = package + '.' + docstring_module_name
+ if (docstring_module_name in sys.modules and
+ sys.modules[docstring_module_name].__doc__):
+ return sys.modules[docstring_module_name].__doc__
+
+ return 'Public API for tf.%s namespace.' % module_name
+
+
def create_api_files(
output_files, package, root_init_template, output_dir):
"""Creates __init__.py files for the Python API.
@@ -296,7 +335,10 @@ def create_api_files(
continue
contents = ''
if module or not root_init_template:
- contents = _GENERATED_FILE_HEADER + text + _GENERATED_FILE_FOOTER
+ contents = (
+ _GENERATED_FILE_HEADER %
+ get_module_docstring(module, package) + text +
+ _GENERATED_FILE_FOOTER)
else:
# Read base init file
with open(root_init_template, 'r') as root_init_template_file:
@@ -309,7 +351,7 @@ def create_api_files(
raise ValueError(
'Missing outputs for python_api_gen genrule:\n%s.'
'Make sure all required outputs are in the '
- 'tensorflow/tools/api/generator/BUILD file.' %
+ 'tensorflow/tools/api/generator/api_gen.bzl file.' %
',\n'.join(sorted(missing_output_files)))
diff --git a/tensorflow/tools/api/generator/doc_srcs.py b/tensorflow/tools/api/generator/doc_srcs.py
new file mode 100644
index 0000000000..74f6db98fd
--- /dev/null
+++ b/tensorflow/tools/api/generator/doc_srcs.py
@@ -0,0 +1,65 @@
+# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ==============================================================================
+"""Specifies sources of doc strings for API modules."""
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+
+import collections
+
+
+# Specifies docstring source for a module.
+# Only one of docstring or docstring_module_name should be set.
+# * If docstring is set, then we will use this docstring when
+# for the module.
+# * If docstring_module_name is set, then we will copy the docstring
+# from docstring source module.
+DocSource = collections.namedtuple(
+ 'DocSource', ['docstring', 'docstring_module_name'])
+# Each attribute of DocSource is optional.
+DocSource.__new__.__defaults__ = (None,) * len(DocSource._fields)
+
+TENSORFLOW_DOC_SOURCES = {
+ 'app': DocSource(docstring_module_name='platform.app'),
+ 'compat': DocSource(docstring_module_name='util.compat'),
+ 'distributions': DocSource(
+ docstring_module_name='ops.distributions.distributions'),
+ 'bitwise': DocSource(docstring_module_name='ops.bitwise_ops'),
+ 'errors': DocSource(docstring_module_name='framework.errors'),
+ 'gfile': DocSource(docstring_module_name='platform.gfile'),
+ 'graph_util': DocSource(docstring_module_name='framework.graph_util'),
+ 'image': DocSource(docstring_module_name='ops.image_ops'),
+ 'keras.estimator': DocSource(docstring_module_name='estimator.keras'),
+ 'linalg': DocSource(docstring_module_name='ops.linalg_ops'),
+ 'logging': DocSource(docstring_module_name='ops.logging_ops'),
+ 'losses': DocSource(docstring_module_name='ops.losses.losses'),
+ 'manip': DocSource(docstring_module_name='ops.manip_ops'),
+ 'math': DocSource(docstring_module_name='ops.math_ops'),
+ 'metrics': DocSource(docstring_module_name='ops.metrics'),
+ 'nn': DocSource(docstring_module_name='ops.nn_ops'),
+ 'nn.rnn_cell': DocSource(docstring_module_name='ops.rnn_cell'),
+ 'python_io': DocSource(docstring_module_name='lib.io.python_io'),
+ 'resource_loader': DocSource(
+ docstring_module_name='platform.resource_loader'),
+ 'sets': DocSource(docstring_module_name='ops.sets'),
+ 'sparse': DocSource(docstring_module_name='ops.sparse_ops'),
+ 'spectral': DocSource(docstring_module_name='ops.spectral_ops'),
+ 'strings': DocSource(docstring_module_name='ops.string_ops'),
+ 'sysconfig': DocSource(docstring_module_name='platform.sysconfig'),
+ 'test': DocSource(docstring_module_name='platform.test'),
+ 'train': DocSource(docstring_module_name='training.training'),
+ 'train.queue_runner': DocSource(
+ docstring_module_name='training.queue_runner'),
+}
diff --git a/tensorflow/tools/api/generator/doc_srcs_test.py b/tensorflow/tools/api/generator/doc_srcs_test.py
new file mode 100644
index 0000000000..9ba95a3439
--- /dev/null
+++ b/tensorflow/tools/api/generator/doc_srcs_test.py
@@ -0,0 +1,80 @@
+# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# =============================================================================
+"""Tests for tensorflow.tools.api.generator.doc_srcs."""
+
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+
+import argparse
+import importlib
+import sys
+
+from tensorflow.python.platform import test
+from tensorflow.tools.api.generator import doc_srcs
+
+
+FLAGS = None
+
+
+class DocSrcsTest(test.TestCase):
+
+ def testModulesAreValidAPIModules(self):
+ for module_name in doc_srcs.TENSORFLOW_DOC_SOURCES:
+ # Convert module_name to corresponding __init__.py file path.
+ file_path = module_name.replace('.', '/')
+ if file_path:
+ file_path += '/'
+ file_path += '__init__.py'
+
+ if file_path not in FLAGS.outputs:
+ self.assertFalse('%s is not a valid API module' % module_name)
+
+ def testHaveDocstringOrDocstringModule(self):
+ for module_name, docsrc in doc_srcs.TENSORFLOW_DOC_SOURCES.items():
+ if docsrc.docstring and docsrc.docstring_module_name:
+ self.assertFalse(
+ '%s contains DocSource has both a docstring and a '
+ 'docstring_module_name. '
+ 'Only one of "docstring" or "docstring_module_name" should be set.'
+ % (module_name))
+
+ def testDocstringModulesAreValidModules(self):
+ for _, docsrc in doc_srcs.TENSORFLOW_DOC_SOURCES.items():
+ if docsrc.docstring_module_name:
+ doc_module_name = '.'.join([
+ FLAGS.package, docsrc.docstring_module_name])
+ if doc_module_name not in sys.modules:
+ sys.assertFalse(
+ 'docsources_module %s is not a valid module under %s.' %
+ (docsrc.docstring_module_name, FLAGS.package))
+
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ 'outputs', metavar='O', type=str, nargs='+',
+ help='create_python_api output files.')
+ parser.add_argument(
+ '--package', type=str,
+ help='Base package that imports modules containing the target tf_export '
+ 'decorators.')
+ FLAGS, unparsed = parser.parse_known_args()
+
+ importlib.import_module(FLAGS.package)
+
+ # Now update argv, so that unittest library does not get confused.
+ sys.argv = [sys.argv[0]] + unparsed
+ test.main()
--
GitLab
From e042e3e051d3bd6bfb63dfd4ad407a82f7d1dacc Mon Sep 17 00:00:00 2001
From: Anna R
Date: Tue, 12 Jun 2018 17:47:58 -0700
Subject: [PATCH 024/519] Remove unused tf_export import
---
tensorflow/tools/api/generator/create_python_api.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/tensorflow/tools/api/generator/create_python_api.py b/tensorflow/tools/api/generator/create_python_api.py
index 31f287b7fe..e3ab056efc 100644
--- a/tensorflow/tools/api/generator/create_python_api.py
+++ b/tensorflow/tools/api/generator/create_python_api.py
@@ -25,7 +25,6 @@ import os
import sys
from tensorflow.python.util import tf_decorator
-from tensorflow.python.util import tf_export
from tensorflow.tools.api.generator import doc_srcs
--
GitLab
From f055a9f2f21154140785b9da7c3b2eae88e65623 Mon Sep 17 00:00:00 2001
From: Brennan Saeta
Date: Tue, 12 Jun 2018 18:09:35 -0700
Subject: [PATCH 025/519] Check to ensure the Cloud TPU is ready before
resolving.
Cherry picking this into the TF 1.9 release.
PiperOrigin-RevId: 200095692
Previous commit: 32c8013f0ab3feb139648ae759e2d0168fb5dc95
---
.../python/training/tpu_cluster_resolver.py | 3 ++
.../training/tpu_cluster_resolver_test.py | 44 +++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/tensorflow/contrib/cluster_resolver/python/training/tpu_cluster_resolver.py b/tensorflow/contrib/cluster_resolver/python/training/tpu_cluster_resolver.py
index 880fca4ea6..935ad5ff37 100644
--- a/tensorflow/contrib/cluster_resolver/python/training/tpu_cluster_resolver.py
+++ b/tensorflow/contrib/cluster_resolver/python/training/tpu_cluster_resolver.py
@@ -255,6 +255,9 @@ class TPUClusterResolver(ClusterResolver):
request = self._service.projects().locations().nodes().get(name=full_name)
response = request.execute()
+ if 'state' in response and response['state'] != 'READY':
+ raise RuntimeError('TPU "%s" is not yet ready; state: "%s"' %
+ (self._tpu, response['state']))
if 'health' in response and response['health'] != 'HEALTHY':
raise RuntimeError('TPU "%s" is unhealthy: "%s"' % (self._tpu,
response['health']))
diff --git a/tensorflow/contrib/cluster_resolver/python/training/tpu_cluster_resolver_test.py b/tensorflow/contrib/cluster_resolver/python/training/tpu_cluster_resolver_test.py
index 5fac55fd02..7e002cc72f 100644
--- a/tensorflow/contrib/cluster_resolver/python/training/tpu_cluster_resolver_test.py
+++ b/tensorflow/contrib/cluster_resolver/python/training/tpu_cluster_resolver_test.py
@@ -157,6 +157,50 @@ class TPUClusterResolverTest(test.TestCase):
job { name: 'worker' tasks { key: 0 value: '10.1.2.3:8470' } }
"""
self._verifyClusterSpecEquality(actual_cluster_spec, expected_proto)
+
+ @mock.patch.object(TPUClusterResolver, '_requestComputeMetadata',
+ mock_request_compute_metadata)
+ def testUnhealthyCloudTpu(self):
+ tpu_map = {
+ 'projects/test-project/locations/us-central1-c/nodes/test-tpu-1': {
+ 'ipAddress': '10.1.2.3',
+ 'port': '8470',
+ 'health': 'UNHEALTHY'
+ }
+ }
+
+ tpu_cluster_resolver = TPUClusterResolver(
+ project=None,
+ zone=None,
+ tpu='test-tpu-1',
+ coordinator_name=None,
+ credentials=None,
+ service=self.mock_service_client(tpu_map=tpu_map))
+
+ with self.assertRaises(RuntimeError):
+ tpu_cluster_resolver.cluster_spec()
+
+ @mock.patch.object(TPUClusterResolver, '_requestComputeMetadata',
+ mock_request_compute_metadata)
+ def testNotReadyCloudTpu(self):
+ tpu_map = {
+ 'projects/test-project/locations/us-central1-c/nodes/test-tpu-1': {
+ 'ipAddress': '10.1.2.3',
+ 'port': '8470',
+ 'state': 'CREATING'
+ }
+ }
+
+ tpu_cluster_resolver = TPUClusterResolver(
+ project=None,
+ zone=None,
+ tpu='test-tpu-1',
+ coordinator_name=None,
+ credentials=None,
+ service=self.mock_service_client(tpu_map=tpu_map))
+
+ with self.assertRaises(RuntimeError):
+ tpu_cluster_resolver.cluster_spec()
def testSimpleSuccessfulRetrieval(self):
tpu_map = {
--
GitLab
From 9a087a42293be8342570039d2c6d329a0589b773 Mon Sep 17 00:00:00 2001
From: Nick Felt
Date: Wed, 13 Jun 2018 00:30:09 -0700
Subject: [PATCH 026/519] Update tensorboard dependency to 1.9.x
---
tensorflow/tools/pip_package/setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py
index 97f625e7e9..92a1465cea 100644
--- a/tensorflow/tools/pip_package/setup.py
+++ b/tensorflow/tools/pip_package/setup.py
@@ -55,7 +55,7 @@ REQUIRED_PACKAGES = [
'six >= 1.10.0',
'protobuf >= 3.4.0',
'setuptools <= 39.1.0',
- 'tensorboard >= 1.8.0, < 1.9.0',
+ 'tensorboard >= 1.9.0, < 1.10.0',
'termcolor >= 1.1.0',
]
--
GitLab
From b1d0048f2be83d6c6f7e1be996ef9c8358922aa6 Mon Sep 17 00:00:00 2001
From: Pete Warden
Date: Wed, 13 Jun 2018 01:06:50 -0700
Subject: [PATCH 027/519] Documentation for Raspberry Pi installation
---
tensorflow/docs_src/install/index.md | 2 +
.../docs_src/install/install_raspbian.md | 317 ++++++++++++++++++
2 files changed, 319 insertions(+)
create mode 100644 tensorflow/docs_src/install/install_raspbian.md
diff --git a/tensorflow/docs_src/install/index.md b/tensorflow/docs_src/install/index.md
index 4f85383925..c2e5a991d4 100644
--- a/tensorflow/docs_src/install/index.md
+++ b/tensorflow/docs_src/install/index.md
@@ -6,6 +6,7 @@ operating systems:
* macOS 10.12.6 (Sierra) or later.
* Ubuntu 16.04 or later
* Windows 7 or later.
+ * Raspbian 9.0 or later.
Although you might be able to install TensorFlow on other laptop or desktop
systems, we only support (and only fix issues in) the preceding configurations.
@@ -16,6 +17,7 @@ that enables you to write applications in Python:
* @{$install_linux$Installing TensorFlow on Ubuntu}
* @{$install_mac$Installing TensorFlow on macOS}
* @{$install_windows$Installing TensorFlow on Windows}
+ * @{$install_raspbian$Installing TensorFlow on a Raspberry Pi}
* @{$install_sources$Installing TensorFlow from Sources}
Many aspects of the Python TensorFlow API changed from version 0.n to 1.0.
diff --git a/tensorflow/docs_src/install/install_raspbian.md b/tensorflow/docs_src/install/install_raspbian.md
new file mode 100644
index 0000000000..2f425162a1
--- /dev/null
+++ b/tensorflow/docs_src/install/install_raspbian.md
@@ -0,0 +1,317 @@
+# Installing TensorFlow on Raspbian
+
+This guide explains how to install TensorFlow on a Raspberry Pi running
+Raspbian. Although these instructions might also work on other Pi variants, we
+have only tested (and we only support) these instructions on machines meeting
+the following requirements:
+
+* Raspberry Pi devices running Raspbian 9.0 or higher
+
+## Determine how to install TensorFlow
+
+You must pick the mechanism by which you install TensorFlow. The supported
+choices are as follows:
+
+* "Native" pip.
+* Cross-compiling from sources.
+
+**We recommend pip installation.**
+
+## Installing with native pip
+
+We have uploaded the TensorFlow binaries to piwheels.org. Therefore, you can
+install TensorFlow through pip.
+
+The [REQUIRED_PACKAGES section of
+setup.py](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/pip_package/setup.py)
+lists the packages that pip will install or upgrade.
+
+### Prerequisite: Python
+
+In order to install TensorFlow, your system must contain one of the following
+Python versions:
+
+* Python 2.7
+* Python 3.4+
+
+If your system does not already have one of the preceding Python versions,
+[install](https://wiki.python.org/moin/BeginnersGuide/Download) it now. It
+should already be included when Raspbian was installed though, so no extra steps
+should be needed.
+
+### Prerequisite: pip
+
+[Pip](https://en.wikipedia.org/wiki/Pip_\(package_manager\)) installs and
+manages software packages written in Python. If you intend to install with
+native pip, then one of the following flavors of pip must be installed on your
+system:
+
+* `pip3`, for Python 3.n (preferred).
+* `pip`, for Python 2.7.
+
+`pip` or `pip3` was probably installed on your system when you installed Python.
+To determine whether pip or pip3 is actually installed on your system, issue one
+of the following commands:
+
+$ pip3 -V # for Python 3.n
+$ pip -V # for Python 2.7
+
+If it gives the error "Command not found", then the package has not been
+installed yet. To install if for the first time, run:
+
+$ sudo apt-get install python3-pip # for Python 3.n
+sudo apt-get install python-pip # for Python 2.7
+
+You can find more help on installing and upgrading pip in
+[the Raspberry Pi documentation](https://www.raspberrypi.org/documentation/linux/software/python.md).
+
+### Prerequisite: Atlas
+
+[Atlas](http://math-atlas.sourceforge.net/) is a linear algebra library that
+numpy depends on, and so needs to be installed before TensorFlow. To add it to
+your system, run the following command:
+
+$ sudo apt install libatlas-base-dev
+
+### Install TensorFlow
+
+Assuming the prerequisite software is installed on your Pi, install TensorFlow
+by invoking **one** of the following commands:
+
+ $ pip3 install tensorflow # Python 3.n
+ $ pip install tensorflow # Python 2.7
+
+This can take some time on certain platforms like the Pi Zero, where some Python
+packages like scipy that TensorFlow depends on need to be compiled before the
+installation can complete. The Python 3 version will typically be faster to
+install because piwheels.org has pre-built versions of the dependencies
+available, so this is our recommended option.
+
+### Next Steps
+
+After installing TensorFlow, [validate your
+installation](#ValidateYourInstallation) to confirm that the installation worked
+properly.
+
+### Uninstalling TensorFlow
+
+To uninstall TensorFlow, issue one of following commands:
+
+$ pip uninstall tensorflow
+$ pip3 uninstall tensorflow
+
+## Cross-compiling from sources
+
+Cross-compilation means building on a different machine than than you'll be
+deploying on. Since Raspberry Pi's only have limited RAM and comparatively slow
+processors, and TensorFlow has a large amount of source code to compile, it's
+easier to use a MacOS or Linux desktop or laptop to handle the build process.
+Because it can take over 24 hours to build on a Pi, and requires external swap
+space to cope with the memory shortage, we recommend using cross-compilation if
+you do need to compile TensorFlow from source. To make the dependency management
+process easier, we also recommend using Docker to help simplify building.
+
+Note that we provide well-tested, pre-built TensorFlow binaries for Raspbian
+systems. So, don't build a TensorFlow binary yourself unless you are very
+comfortable building complex packages from source and dealing with the
+inevitable aftermath should things not go exactly as documented
+
+### Prerequisite: Docker
+
+Install Docker on your machine as described in the [Docker
+documentation](https://docs.docker.com/engine/installation/#/on-macos-and-windows).
+
+### Clone the TensorFlow repository
+
+Start the process of building TensorFlow by cloning a TensorFlow repository.
+
+To clone **the latest** TensorFlow repository, issue the following command:
+
+$ git clone https://github.com/tensorflow/tensorflow
+
+The preceding git clone command creates a subdirectory named
+`tensorflow`. After cloning, you may optionally build a **specific branch**
+(such as a release branch) by invoking the following commands:
+
+
+$ cd tensorflow
+$ git checkout Branch # where Branch is the desired branch
+
+
+For example, to work with the `r1.0` release instead of the master release,
+issue the following command:
+
+$ git checkout r1.0
+
+### Build from source
+
+To compile TensorFlow and produce a binary pip can install, do the following:
+
+1. Start a terminal.
+2. Navigate to the directory containing the tensorflow source code.
+3. Run a command to cross-compile the library, for example:
+
+$ CI_DOCKER_EXTRA_PARAMS="-e CI_BUILD_PYTHON=python3 -e CROSSTOOL_PYTHON_INCLUDE_PATH=/usr/include/python3.4" \
+tensorflow/tools/ci_build/ci_build.sh PI-PYTHON3 tensorflow/tools/ci_build/pi/build_raspberry_pi.sh
+
+
+This will build a pip .whl file for Python 3.4, with Arm v7 instructions that
+will only work on the Pi models 2 or 3. These NEON instructions are required for
+the fastest operation on those devices, but you can build a library that will
+run across all Pi devices by passing `PI_ONE` at the end of the command line.
+You can also target Python 2.7 by omitting the initial docker parameters. Here's
+an example of building for Python 2.7 and Raspberry Pi model Zero or One
+devices:
+
+$ tensorflow/tools/ci_build/ci_build.sh PI tensorflow/tools/ci_build/pi/build_raspberry_pi.sh PI_ONE
+
+This will take some time to complete, typically twenty or thirty minutes, and
+should produce a .whl file in an output-artifacts sub-folder inside your source
+tree at the end. This wheel file can be installed through pip or pip3 (depending
+on your Python version) by copying it to a Raspberry Pi and running a terminal
+command like this (with the name of your actual file substituted):
+
+$ pip3 install tensorflow-1.9.0-cp34-none-linux_armv7l.whl
+
+### Troubleshooting the build
+
+The build script uses Docker internally to create a Linux virtual machine to
+handle the compilation. If you do have problems running the script, first check
+that you're able to run Docker tests like `docker run hello-world` on your
+system.
+
+If you're building from the latest development branch, try syncing to an older
+version that's known to work, for example release 1.9, with a command like this:
+
+$ git checkout r1.0
+
+
+
+## Validate your installation
+
+To validate your TensorFlow installation, do the following:
+
+1. Ensure that your environment is prepared to run TensorFlow programs.
+2. Run a short TensorFlow program.
+
+### Prepare your environment
+
+If you installed on native pip, Virtualenv, or Anaconda, then do the following:
+
+1. Start a terminal.
+2. If you installed TensorFlow source code, navigate to any directory *except*
+ one containing TensorFlow source code.
+
+### Run a short TensorFlow program
+
+Invoke python from your shell as follows:
+
+$ python
+
+Enter the following short program inside the python interactive shell:
+
+```python
+# Python
+import tensorflow as tf
+hello = tf.constant('Hello, TensorFlow!')
+sess = tf.Session()
+print(sess.run(hello))
+```
+
+If the system outputs the following, then you are ready to begin writing
+TensorFlow programs:
+
+Hello, TensorFlow!
+
+If you're running with Python 3.5, you may see a warning when you first import
+TensorFlow. This is not an error, and TensorFlow should continue to run with no
+problems, despite the log message.
+
+If the system outputs an error message instead of a greeting, see [Common
+installation problems](#common_installation_problems).
+
+If you are new to machine learning, we recommend the [Machine Learning Crash
+Course](https://developers.google.com/machine-learning/crash-course).
+
+If you are experienced with machine learning but new to TensorFlow, see
+@{$get_started/eager}.
+
+## Common installation problems
+
+We are relying on Stack Overflow to document TensorFlow installation problems
+and their remedies. The following table contains links to Stack Overflow answers
+for some common installation problems. If you encounter an error message or
+other installation problem not listed in the following table, search for it on
+Stack Overflow. If Stack Overflow doesn't show the error message, ask a new
+question about it on Stack Overflow and specify the `tensorflow` tag.
+
+
+ | Stack Overflow Link | Error Message |
+
+
+
+ | 42006320 |
+ ImportError: Traceback (most recent call last):
+File ".../tensorflow/core/framework/graph_pb2.py", line 6, in
+from google.protobuf import descriptor as _descriptor
+ImportError: cannot import name 'descriptor'
+ |
+
+
+
+ | 33623453 |
+ IOError: [Errno 2] No such file or directory:
+ '/tmp/pip-o6Tpui-build/setup.py'
+ |
+
+
+ | 35190574 |
+ SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
+ failed |
+
+
+
+ | 42009190 |
+
+ Installing collected packages: setuptools, protobuf, wheel, numpy, tensorflow
+ Found existing installation: setuptools 1.1.6
+ Uninstalling setuptools-1.1.6:
+ Exception:
+ ...
+ [Errno 1] Operation not permitted:
+ '/tmp/pip-a1DXRT-uninstall/.../lib/python/_markerlib' |
+
+
+
+ | 33622019 |
+ ImportError: No module named copyreg |
+
+
+
+ | 37810228 |
+ During a pip install operation, the system returns:
+ OSError: [Errno 1] Operation not permitted
+ |
+
+
+
+ | 33622842 |
+ An import tensorflow statement triggers an error such as the
+ following:Traceback (most recent call last):
+ File "", line 1, in
+ File "/usr/local/lib/python2.7/site-packages/tensorflow/__init__.py",
+ line 4, in
+ from tensorflow.python import *
+ ...
+ File "/usr/local/lib/python2.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py",
+ line 22, in
+ serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"d\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02
+ \x03(\x0b\x32
+ .tensorflow.TensorShapeProto.Dim\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01
+ \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tb\x06proto3')
+ TypeError: __init__() got an unexpected keyword argument 'syntax'
+ |
+
+
+
+
--
GitLab
From 76b8b01740233ff289d70a0d516c6e0ac0e6b042 Mon Sep 17 00:00:00 2001
From: Allen Lavoie
Date: Mon, 11 Jun 2018 11:55:34 -0700
Subject: [PATCH 028/519] Use the Keras session for saving/loading in
TensorFlow format
Fixes issues when there's no default session
PiperOrigin-RevId: 200088574
---
tensorflow/python/keras/engine/network.py | 10 +++-
tensorflow/python/keras/engine/saving_test.py | 52 +++++++++++++------
2 files changed, 44 insertions(+), 18 deletions(-)
diff --git a/tensorflow/python/keras/engine/network.py b/tensorflow/python/keras/engine/network.py
index 9dbf94a276..3d567b8378 100644
--- a/tensorflow/python/keras/engine/network.py
+++ b/tensorflow/python/keras/engine/network.py
@@ -20,6 +20,7 @@ from __future__ import division
from __future__ import print_function
import copy
+import functools
import json
import os
import weakref
@@ -1264,7 +1265,11 @@ class Network(base_layer.Layer):
with h5py.File(filepath, 'w') as f:
saving.save_weights_to_hdf5_group(f, self.layers)
else:
- self._checkpointable_saver.save(filepath)
+ if context.executing_eagerly():
+ session = None
+ else:
+ session = backend.get_session()
+ self._checkpointable_saver.save(filepath, session=session)
def load_weights(self, filepath, by_name=False):
"""Loads all layer weights, either from a TensorFlow or an HDF5 weight file.
@@ -1324,7 +1329,8 @@ class Network(base_layer.Layer):
'loading TensorFlow-formatted weights (got by_name=True to '
'load_weights).')
if not context.executing_eagerly():
- finalizer = status.run_restore_ops
+ session = backend.get_session()
+ finalizer = functools.partial(status.run_restore_ops, session=session)
if self.built:
finalizer()
else:
diff --git a/tensorflow/python/keras/engine/saving_test.py b/tensorflow/python/keras/engine/saving_test.py
index 30bcd3d185..b5448a9be1 100644
--- a/tensorflow/python/keras/engine/saving_test.py
+++ b/tensorflow/python/keras/engine/saving_test.py
@@ -404,26 +404,27 @@ class TestWholeModelSaving(test.TestCase):
os.remove(fname)
def test_saving_lambda_numpy_array_arguments(self):
- if h5py is None:
- self.skipTest('h5py required to run this test')
+ with self.test_session():
+ if h5py is None:
+ self.skipTest('h5py required to run this test')
- mean = np.random.random((4, 2, 3))
- std = np.abs(np.random.random((4, 2, 3))) + 1e-5
- inputs = keras.layers.Input(shape=(4, 2, 3))
- output = keras.layers.Lambda(lambda image, mu, std: (image - mu) / std,
- arguments={'mu': mean, 'std': std})(inputs)
- model = keras.models.Model(inputs, output)
- model.compile(loss='mse', optimizer='sgd', metrics=['acc'])
+ mean = np.random.random((4, 2, 3))
+ std = np.abs(np.random.random((4, 2, 3))) + 1e-5
+ inputs = keras.layers.Input(shape=(4, 2, 3))
+ output = keras.layers.Lambda(lambda image, mu, std: (image - mu) / std,
+ arguments={'mu': mean, 'std': std})(inputs)
+ model = keras.models.Model(inputs, output)
+ model.compile(loss='mse', optimizer='sgd', metrics=['acc'])
- fd, fname = tempfile.mkstemp('.h5')
- keras.models.save_model(model, fname)
+ fd, fname = tempfile.mkstemp('.h5')
+ keras.models.save_model(model, fname)
- model = keras.models.load_model(fname)
- os.close(fd)
- os.remove(fname)
+ model = keras.models.load_model(fname)
+ os.close(fd)
+ os.remove(fname)
- self.assertAllClose(mean, model.layers[1].arguments['mu'])
- self.assertAllClose(std, model.layers[1].arguments['std'])
+ self.assertAllClose(mean, model.layers[1].arguments['mu'])
+ self.assertAllClose(std, model.layers[1].arguments['std'])
def test_saving_model_with_long_layer_names(self):
if h5py is None:
@@ -580,6 +581,25 @@ class TestWeightSavingAndLoadingTFFormat(test.TestCase):
# Indirectly tests that the user is prompted
model.save_weights(prefix, save_format='tensorflow', overwrite=False)
+ def test_no_default_session(self):
+ with ops.Graph().as_default():
+ self.assertFalse(ops.get_default_session())
+ data = np.random.random((1000, 32)).astype(np.float32)
+ labels = np.random.random((1000, 10)).astype(np.float32)
+
+ model = keras.models.Sequential([
+ keras.layers.Dense(10, activation='softmax'),
+ keras.layers.Dense(10, activation='softmax')])
+
+ model.compile(optimizer=training_module.RMSPropOptimizer(0.001),
+ loss='categorical_crossentropy',
+ metrics=['accuracy'])
+
+ model.fit(data, labels)
+ fname = os.path.join(self.get_temp_dir(), 'weights', 'ckpt')
+ model.save_weights(fname)
+ model.load_weights(fname)
+
def test_no_graph_pollution(self):
with context.graph_mode():
graph = ops.Graph()
--
GitLab
From 50ba6dd3a182c9578bc10cb2a21d7914a1e7bac1 Mon Sep 17 00:00:00 2001
From: Akshay Modi
Date: Mon, 11 Jun 2018 10:42:15 -0700
Subject: [PATCH 029/519] Don't call back into python during insert (which will
leave the set in a broken condition if the runtime decides to let another
thread run).
Thank you for finding the bug. The watched_variables_ set should not really require a lock since all our functions hold the GIL (verified by looking at the generated SWIG). The reason that there was a concurrent access to the set is that the insert was calling back into python (which might release the GIL and let another thread run, which will also attempt to insert a variable and break the set).
I included the lock to be safe though, since its non-trivial to verify without looking at the generated swig wrappers that the GIL is held.
PiperOrigin-RevId: 200074843
---
tensorflow/python/eager/pywrap_tfe_src.cc | 82 ++++++++++++-----------
1 file changed, 43 insertions(+), 39 deletions(-)
diff --git a/tensorflow/python/eager/pywrap_tfe_src.cc b/tensorflow/python/eager/pywrap_tfe_src.cc
index e3ce0ef9d0..52b3268903 100644
--- a/tensorflow/python/eager/pywrap_tfe_src.cc
+++ b/tensorflow/python/eager/pywrap_tfe_src.cc
@@ -873,22 +873,6 @@ static tensorflow::DataType FastTensorDtype(PyObject* tensor) {
return static_cast(id);
}
-static tensorflow::int64 FastHandleId(PyObject* variable) {
- PyObject* handle = PyObject_GetAttrString(variable, "handle");
- if (handle == nullptr) {
- return -1;
- }
- tensorflow::int64 id = FastTensorId(handle);
- Py_DECREF(handle);
- return id;
-}
-
-struct CompareByHandleId {
- bool operator()(PyObject* lhs, PyObject* rhs) {
- return FastHandleId(lhs) < FastHandleId(rhs);
- }
-};
-
class GradientTape
: public tensorflow::eager::GradientTape {
public:
@@ -897,35 +881,63 @@ class GradientTape
persistent) {}
virtual ~GradientTape() {
- for (PyObject* v : watched_variables_) {
- Py_DECREF(v);
+ for (const IdAndVariable& v : watched_variables_) {
+ Py_DECREF(v.variable);
}
}
void WatchVariable(PyObject* v) {
- auto insert_result = watched_variables_.insert(v);
- if (insert_result.second) {
- // Only increment the reference count if we aren't already watching this
- // variable.
- Py_INCREF(v);
- }
- PyObject* handle = PyObject_GetAttrString(v, "handle");
+ tensorflow::Safe_PyObjectPtr handle(PyObject_GetAttrString(v, "handle"));
if (handle == nullptr) {
return;
}
- tensorflow::int64 id = FastTensorId(handle);
- Py_DECREF(handle);
+ tensorflow::int64 id = FastTensorId(handle.get());
+
if (!PyErr_Occurred()) {
this->Watch(id);
}
+
+ tensorflow::mutex_lock l(watched_variables_mu_);
+ auto insert_result = watched_variables_.emplace(id, v);
+
+ if (insert_result.second) {
+ // Only increment the reference count if we aren't already watching this
+ // variable.
+ Py_INCREF(v);
+ }
}
- const std::set WatchedVariables() {
- return watched_variables_;
+ PyObject* GetVariablesAsPyTuple() {
+ tensorflow::mutex_lock l(watched_variables_mu_);
+ PyObject* result = PyTuple_New(watched_variables_.size());
+ Py_ssize_t pos = 0;
+ for (const IdAndVariable& id_and_variable : watched_variables_) {
+ PyTuple_SET_ITEM(result, pos++, id_and_variable.variable);
+ Py_INCREF(id_and_variable.variable);
+ }
+ return result;
}
private:
- std::set watched_variables_;
+ // We store an IdAndVariable in the map since the map needs to be locked
+ // during insert, but should not call back into python during insert to avoid
+ // deadlocking with the GIL.
+ struct IdAndVariable {
+ tensorflow::int64 id;
+ PyObject* variable;
+
+ IdAndVariable(tensorflow::int64 id, PyObject* variable)
+ : id(id), variable(variable) {}
+ };
+ struct CompareById {
+ bool operator()(const IdAndVariable& lhs, const IdAndVariable& rhs) {
+ return lhs.id < rhs.id;
+ }
+ };
+
+ tensorflow::mutex watched_variables_mu_;
+ std::set watched_variables_
+ GUARDED_BY(watched_variables_mu_);
};
typedef struct {
@@ -1217,15 +1229,7 @@ void TFE_Py_TapeSetWatchVariable(PyObject* variable) {
}
PyObject* TFE_Py_TapeWatchedVariables(PyObject* tape) {
- const auto& watched_variables =
- reinterpret_cast(tape)->tape->WatchedVariables();
- PyObject* result = PyTuple_New(watched_variables.size());
- Py_ssize_t pos = 0;
- for (PyObject* variable : watched_variables) {
- PyTuple_SET_ITEM(result, pos++, variable);
- Py_INCREF(variable);
- }
- return result;
+ return reinterpret_cast(tape)->tape->GetVariablesAsPyTuple();
}
namespace {
--
GitLab
From ec769c7ec368adf90aaa0b6d2a97525da14e1a37 Mon Sep 17 00:00:00 2001
From: Akshay Modi
Date: Mon, 11 Jun 2018 16:27:12 -0700
Subject: [PATCH 030/519] Remove memory leak in read variable call, and record
gradient call.
Fix #19385
PiperOrigin-RevId: 200132949
---
tensorflow/python/eager/pywrap_tfe_src.cc | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tensorflow/python/eager/pywrap_tfe_src.cc b/tensorflow/python/eager/pywrap_tfe_src.cc
index 52b3268903..6c9481c3af 100644
--- a/tensorflow/python/eager/pywrap_tfe_src.cc
+++ b/tensorflow/python/eager/pywrap_tfe_src.cc
@@ -1873,6 +1873,8 @@ PyObject* RecordGradient(PyObject* op_name, PyObject* inputs, PyObject* attrs,
delete backward_function;
});
+ Py_DECREF(num_inputs);
+
Py_RETURN_NONE;
}
@@ -1931,8 +1933,10 @@ bool ReadVariableOp(const FastPathOpExecInfo& parent_op_exec_info,
Py_INCREF(output->get()); // stay alive after since tuple steals.
PyTuple_SET_ITEM(outputs.get(), 0, output->get());
- if (!RecordGradient(GetPythonObjectFromString("ReadVariableOp"),
- inputs.get(), Py_None, outputs.get(), Py_None)) {
+ tensorflow::Safe_PyObjectPtr op_string(
+ GetPythonObjectFromString("ReadVariableOp"));
+ if (!RecordGradient(op_string.get(), inputs.get(), Py_None, outputs.get(),
+ Py_None)) {
return false;
}
}
--
GitLab
From c77fead531bc3756d765ba90e2e549abd7adf320 Mon Sep 17 00:00:00 2001
From: Brennan Saeta
Date: Wed, 13 Jun 2018 15:46:12 -0700
Subject: [PATCH 031/519] Make GCS ops work in open source
---
tensorflow/contrib/cloud/__init__.py | 5 +++--
tensorflow/contrib/cloud/kernels/BUILD | 1 +
tensorflow/core/platform/cloud/gcs_file_system.cc | 4 +++-
tensorflow/core/platform/default/build_config.bzl | 2 ++
4 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/tensorflow/contrib/cloud/__init__.py b/tensorflow/contrib/cloud/__init__.py
index a6e13ea3ae..ef7aa7624c 100644
--- a/tensorflow/contrib/cloud/__init__.py
+++ b/tensorflow/contrib/cloud/__init__.py
@@ -27,8 +27,9 @@ from tensorflow.python.util.all_util import remove_undocumented
_allowed_symbols = [
'BigQueryReader',
- 'ConfigureColabSession',
- 'ConfigureGcs',
+ 'BlockCacheParams',
+ 'configure_colab_session',
+ 'configure_gcs',
'ConfigureGcsHook',
]
remove_undocumented(__name__, _allowed_symbols)
diff --git a/tensorflow/contrib/cloud/kernels/BUILD b/tensorflow/contrib/cloud/kernels/BUILD
index 40160706f7..1311063ec0 100644
--- a/tensorflow/contrib/cloud/kernels/BUILD
+++ b/tensorflow/contrib/cloud/kernels/BUILD
@@ -79,6 +79,7 @@ tf_kernel_library(
srcs = ["gcs_config_ops.cc"],
visibility = ["//tensorflow:internal"],
deps = [
+ "//tensorflow/contrib/cloud:gcs_config_ops_op_lib",
"//tensorflow/core:framework",
"//tensorflow/core:lib",
"//tensorflow/core/platform/cloud:curl_http_request",
diff --git a/tensorflow/core/platform/cloud/gcs_file_system.cc b/tensorflow/core/platform/cloud/gcs_file_system.cc
index 22ae6121e0..803b08f1a3 100644
--- a/tensorflow/core/platform/cloud/gcs_file_system.cc
+++ b/tensorflow/core/platform/cloud/gcs_file_system.cc
@@ -804,7 +804,9 @@ void GcsFileSystem::ResetFileBlockCache(size_t block_size_bytes,
mutex_lock l(block_cache_lock_);
file_block_cache_ =
MakeFileBlockCache(block_size_bytes, max_bytes, max_staleness_secs);
- stats_->Configure(this, &throttle_, file_block_cache_.get());
+ if (stats_) {
+ stats_->Configure(this, &throttle_, file_block_cache_.get());
+ }
}
// A helper function to build a FileBlockCache for GcsFileSystem.
diff --git a/tensorflow/core/platform/default/build_config.bzl b/tensorflow/core/platform/default/build_config.bzl
index 9e52ba344a..f12732b434 100644
--- a/tensorflow/core/platform/default/build_config.bzl
+++ b/tensorflow/core/platform/default/build_config.bzl
@@ -633,6 +633,7 @@ def tf_additional_cloud_op_deps():
"//tensorflow:with_gcp_support_ios_override": [],
"//tensorflow:with_gcp_support": [
"//tensorflow/contrib/cloud:bigquery_reader_ops_op_lib",
+ "//tensorflow/contrib/cloud:gcs_config_ops_op_lib",
],
"//conditions:default": [],
})
@@ -645,6 +646,7 @@ def tf_additional_cloud_kernel_deps():
"//tensorflow:with_gcp_support_ios_override": [],
"//tensorflow:with_gcp_support": [
"//tensorflow/contrib/cloud/kernels:bigquery_reader_ops",
+ "//tensorflow/contrib/cloud/kernels:gcs_config_ops",
],
"//conditions:default": [],
})
--
GitLab
From f9a44a69c35dcf7f1c0f42e1ae9971bae0148099 Mon Sep 17 00:00:00 2001
From: Brennan Saeta
Date: Wed, 13 Jun 2018 18:05:39 -0700
Subject: [PATCH 032/519] Update the docs and api_def.
---
.../contrib/cloud/ops/gcs_config_ops.cc | 42 +------------------
.../api_def_GcsConfigureBlockCache.pbtxt | 9 ++++
.../api_def_GcsConfigureCredentials.pbtxt | 33 +++++++++++++++
3 files changed, 44 insertions(+), 40 deletions(-)
create mode 100644 tensorflow/core/api_def/base_api/api_def_GcsConfigureBlockCache.pbtxt
create mode 100644 tensorflow/core/api_def/base_api/api_def_GcsConfigureCredentials.pbtxt
diff --git a/tensorflow/contrib/cloud/ops/gcs_config_ops.cc b/tensorflow/contrib/cloud/ops/gcs_config_ops.cc
index 9cf85f5f18..5e31a15498 100644
--- a/tensorflow/contrib/cloud/ops/gcs_config_ops.cc
+++ b/tensorflow/contrib/cloud/ops/gcs_config_ops.cc
@@ -21,50 +21,12 @@ namespace tensorflow {
REGISTER_OP("GcsConfigureCredentials")
.Input("json: string")
- .SetShapeFn(shape_inference::NoOutputs)
- .Doc(R"doc(
-Configures the credentials used by the GCS client of the local TF runtime.
-
-The json input can be of the format:
-
-1. Refresh Token:
-{
- "client_id": "",
- "client_secret": "",
- "refresh_token: "",
- "type": "authorized_user",
-}
-
-2. Service Account:
-{
- "type": "service_account",
- "project_id": "",
- "private_key_id": "",
- "private_key": "------BEGIN PRIVATE KEY-----\n\n-----END PRIVATE KEY------\n",
- "client_email": "@.iam.gserviceaccount.com",
- "client_id": "",
- # Some additional fields elided
-}
-
-Note the credentials established through this method are shared across all
-sessions run on this runtime.
-
-Note be sure to feed the inputs to this op to ensure the credentials are not
-stored in a constant op within the graph that might accidentally be checkpointed
-or in other ways be persisted or exfiltrated.
-)doc");
+ .SetShapeFn(shape_inference::NoOutputs);
REGISTER_OP("GcsConfigureBlockCache")
.Input("max_cache_size: uint64")
.Input("block_size: uint64")
.Input("max_staleness: uint64")
- .SetShapeFn(shape_inference::NoOutputs)
- .Doc(R"doc(
-Re-configures the GCS block cache with the new configuration values.
-
-If the values are the same as already configured values, this op is a no-op. If
-they are different, the current contents of the block cache is dropped, and a
-new block cache is created fresh.
-)doc");
+ .SetShapeFn(shape_inference::NoOutputs);
} // namespace tensorflow
diff --git a/tensorflow/core/api_def/base_api/api_def_GcsConfigureBlockCache.pbtxt b/tensorflow/core/api_def/base_api/api_def_GcsConfigureBlockCache.pbtxt
new file mode 100644
index 0000000000..9d32940c64
--- /dev/null
+++ b/tensorflow/core/api_def/base_api/api_def_GcsConfigureBlockCache.pbtxt
@@ -0,0 +1,9 @@
+op {
+ graph_op_name: "GcsConfigureBlockCache"
+ summary: "Re-configures the GCS block cache with the new configuration values."
+ description: <",
+ "client_secret": "",
+ "refresh_token: "",
+ "type": "authorized_user",
+}
+
+2. Service Account:
+{
+ "type": "service_account",
+ "project_id": "",
+ "private_key_id": "",
+ "private_key": "------BEGIN PRIVATE KEY-----\n\n-----END PRIVATE KEY------\n",
+ "client_email": "@.iam.gserviceaccount.com",
+ "client_id": "",
+ # Some additional fields elided
+}
+
+Note the credentials established through this method are shared across all
+sessions run on this runtime.
+
+Note be sure to feed the inputs to this op to ensure the credentials are not
+stored in a constant op within the graph that might accidentally be checkpointed
+or in other ways be persisted or exfiltrated.
+END0
+}
--
GitLab
From ea3bdbc7ea72e488566326aeb446681a557f4334 Mon Sep 17 00:00:00 2001
From: Michael Case
Date: Thu, 14 Jun 2018 06:17:00 -0700
Subject: [PATCH 033/519] Update version strings for 1.9.0-rc1.
---
tensorflow/core/public/version.h | 2 +-
tensorflow/docs_src/install/install_c.md | 2 +-
tensorflow/docs_src/install/install_go.md | 2 +-
tensorflow/docs_src/install/install_java.md | 22 +++++++++----------
tensorflow/docs_src/install/install_linux.md | 18 +++++++--------
tensorflow/docs_src/install/install_mac.md | 10 ++++-----
.../docs_src/install/install_sources.md | 4 ++--
tensorflow/tools/pip_package/setup.py | 2 +-
8 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/tensorflow/core/public/version.h b/tensorflow/core/public/version.h
index cb1fd09dbb..9e5e747557 100644
--- a/tensorflow/core/public/version.h
+++ b/tensorflow/core/public/version.h
@@ -24,7 +24,7 @@ limitations under the License.
// TF_VERSION_SUFFIX is non-empty for pre-releases (e.g. "-alpha", "-alpha.1",
// "-beta", "-rc", "-rc.1")
-#define TF_VERSION_SUFFIX "-rc0"
+#define TF_VERSION_SUFFIX "-rc1"
#define TF_STR_HELPER(x) #x
#define TF_STR(x) TF_STR_HELPER(x)
diff --git a/tensorflow/docs_src/install/install_c.md b/tensorflow/docs_src/install/install_c.md
index 2901848745..2f81ae0c40 100644
--- a/tensorflow/docs_src/install/install_c.md
+++ b/tensorflow/docs_src/install/install_c.md
@@ -38,7 +38,7 @@ enable TensorFlow for C:
OS="linux" # Change to "darwin" for macOS
TARGET_DIRECTORY="/usr/local"
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-${OS}-x86_64-1.9.0-rc0.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-${OS}-x86_64-1.9.0-rc1.tar.gz" |
sudo tar -C $TARGET_DIRECTORY -xz
The `tar` command extracts the TensorFlow C library into the `lib`
diff --git a/tensorflow/docs_src/install/install_go.md b/tensorflow/docs_src/install/install_go.md
index 55bc0f64e7..1c03dd223e 100644
--- a/tensorflow/docs_src/install/install_go.md
+++ b/tensorflow/docs_src/install/install_go.md
@@ -38,7 +38,7 @@ steps to install this library and enable TensorFlow for Go:
TF_TYPE="cpu" # Change to "gpu" for GPU support
TARGET_DIRECTORY='/usr/local'
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-$(go env GOOS)-x86_64-1.9.0-rc0.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-$(go env GOOS)-x86_64-1.9.0-rc1.tar.gz" |
sudo tar -C $TARGET_DIRECTORY -xz
The `tar` command extracts the TensorFlow C library into the `lib`
diff --git a/tensorflow/docs_src/install/install_java.md b/tensorflow/docs_src/install/install_java.md
index b3b739212e..c73e2f4281 100644
--- a/tensorflow/docs_src/install/install_java.md
+++ b/tensorflow/docs_src/install/install_java.md
@@ -36,7 +36,7 @@ following to the project's `pom.xml` to use the TensorFlow Java APIs:
org.tensorflow
tensorflow
- 1.9.0-rc0
+ 1.9.0-rc1
```
@@ -65,7 +65,7 @@ As an example, these steps will create a Maven project that uses TensorFlow:
org.tensorflow
tensorflow
- 1.9.0-rc0
+ 1.9.0-rc1
@@ -124,12 +124,12 @@ instead:
org.tensorflow
libtensorflow
- 1.9.0-rc0
+ 1.9.0-rc1
org.tensorflow
libtensorflow_jni_gpu
- 1.9.0-rc0
+ 1.9.0-rc1
```
@@ -148,7 +148,7 @@ refer to the simpler instructions above instead.
Take the following steps to install TensorFlow for Java on Linux or macOS:
1. Download
- [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc0.jar),
+ [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc1.jar),
which is the TensorFlow Java Archive (JAR).
2. Decide whether you will run TensorFlow for Java on CPU(s) only or with
@@ -167,7 +167,7 @@ Take the following steps to install TensorFlow for Java on Linux or macOS:
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
mkdir -p ./jni
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-${TF_TYPE}-${OS}-x86_64-1.9.0-rc0.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-${TF_TYPE}-${OS}-x86_64-1.9.0-rc1.tar.gz" |
tar -xz -C ./jni
### Install on Windows
@@ -175,10 +175,10 @@ Take the following steps to install TensorFlow for Java on Linux or macOS:
Take the following steps to install TensorFlow for Java on Windows:
1. Download
- [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc0.jar),
+ [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc1.jar),
which is the TensorFlow Java Archive (JAR).
2. Download the following Java Native Interface (JNI) file appropriate for
- [TensorFlow for Java on Windows](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-cpu-windows-x86_64-1.9.0-rc0.zip).
+ [TensorFlow for Java on Windows](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-cpu-windows-x86_64-1.9.0-rc1.zip).
3. Extract this .zip file.
@@ -227,7 +227,7 @@ must be part of your `classpath`. For example, you can include the
downloaded `.jar` in your `classpath` by using the `-cp` compilation flag
as follows:
-javac -cp libtensorflow-1.9.0-rc0.jar HelloTF.java
+javac -cp libtensorflow-1.9.0-rc1.jar HelloTF.java
### Running
@@ -241,11 +241,11 @@ two files are available to the JVM:
For example, the following command line executes the `HelloTF` program on Linux
and macOS X:
-java -cp libtensorflow-1.9.0-rc0.jar:. -Djava.library.path=./jni HelloTF
+java -cp libtensorflow-1.9.0-rc1.jar:. -Djava.library.path=./jni HelloTF
And the following command line executes the `HelloTF` program on Windows:
-java -cp libtensorflow-1.9.0-rc0.jar;. -Djava.library.path=jni HelloTF
+java -cp libtensorflow-1.9.0-rc1.jar;. -Djava.library.path=jni HelloTF
If the program prints Hello from version, you've successfully
installed TensorFlow for Java and are ready to use the API. If the program
diff --git a/tensorflow/docs_src/install/install_linux.md b/tensorflow/docs_src/install/install_linux.md
index 2ecab808c4..9baf6870be 100644
--- a/tensorflow/docs_src/install/install_linux.md
+++ b/tensorflow/docs_src/install/install_linux.md
@@ -438,7 +438,7 @@ Take the following steps to install TensorFlow in an Anaconda environment:
(tensorflow)$ pip install --ignore-installed --upgrade \
- https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp34-cp34m-linux_x86_64.whl
+ https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc1-cp34-cp34m-linux_x86_64.whl
## Validate your installation
@@ -684,14 +684,14 @@ This section documents the relevant values for Linux installations.
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp27-none-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc1-cp27-none-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc0-cp27-none-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc1-cp27-none-linux_x86_64.whl
Note that GPU support requires the NVIDIA hardware and software described in
@@ -703,14 +703,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp34-cp34m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc1-cp34-cp34m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc0-cp34-cp34m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc1-cp34-cp34m-linux_x86_64.whl
Note that GPU support requires the NVIDIA hardware and software described in
@@ -722,14 +722,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp35-cp35m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc1-cp35-cp35m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc0-cp35-cp35m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc1-cp35-cp35m-linux_x86_64.whl
@@ -741,14 +741,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp36-cp36m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc1-cp36-cp36m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc0-cp36-cp36m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc1-cp36-cp36m-linux_x86_64.whl
diff --git a/tensorflow/docs_src/install/install_mac.md b/tensorflow/docs_src/install/install_mac.md
index 9d01271c5a..693254f876 100644
--- a/tensorflow/docs_src/install/install_mac.md
+++ b/tensorflow/docs_src/install/install_mac.md
@@ -119,7 +119,7 @@ Take the following steps to install TensorFlow with Virtualenv:
TensorFlow in the active Virtualenv is as follows:
$ pip3 install --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py3-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc1-py3-none-any.whl
If you encounter installation problems, see
[Common Installation Problems](#common-installation-problems).
@@ -242,7 +242,7 @@ take the following steps:
issue the following command:
$ sudo pip3 install --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py3-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc1-py3-none-any.whl
If the preceding command fails, see
[installation problems](#common-installation-problems).
@@ -350,7 +350,7 @@ Take the following steps to install TensorFlow in an Anaconda environment:
TensorFlow for Python 2.7:
(targetDirectory)$ pip install --ignore-installed --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py2-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc1-py2-none-any.whl
@@ -522,7 +522,7 @@ The value you specify depends on your Python version.
-https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py2-none-any.whl
+https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc1-py2-none-any.whl
@@ -530,5 +530,5 @@ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py2-none-a
-https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py3-none-any.whl
+https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc1-py3-none-any.whl
diff --git a/tensorflow/docs_src/install/install_sources.md b/tensorflow/docs_src/install/install_sources.md
index d25e641cee..70e97cf556 100644
--- a/tensorflow/docs_src/install/install_sources.md
+++ b/tensorflow/docs_src/install/install_sources.md
@@ -328,10 +328,10 @@ Invoke `pip install` to install that pip package.
The filename of the `.whl` file depends on your platform.
For example, the following command will install the pip package
-for TensorFlow 1.9.0rc0 on Linux:
+for TensorFlow 1.9.0rc1 on Linux:
-$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.9.0rc0-py2-none-any.whl
+$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.9.0rc1-py2-none-any.whl
## Validate your installation
diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py
index 92a1465cea..eb2e359ee5 100644
--- a/tensorflow/tools/pip_package/setup.py
+++ b/tensorflow/tools/pip_package/setup.py
@@ -45,7 +45,7 @@ DOCLINES = __doc__.split('\n')
# This version string is semver compatible, but incompatible with pip.
# For pip, we will remove all '-' characters from this string, and use the
# result for pip.
-_VERSION = '1.9.0-rc0'
+_VERSION = '1.9.0-rc1'
REQUIRED_PACKAGES = [
'absl-py >= 0.1.6',
--
GitLab
From f5ee4df50af4041dc0063d0adc31c7a6eebdbcd3 Mon Sep 17 00:00:00 2001
From: Billy Lamberta
Date: Fri, 8 Jun 2018 15:47:19 -0700
Subject: [PATCH 034/519] Copy edits to Keras guide, formatting, moving some
things around. Make the right TOC nav more useful.
PiperOrigin-RevId: 199863216
---
.../docs_src/programmers_guide/keras.md | 870 ++++++++----------
1 file changed, 389 insertions(+), 481 deletions(-)
diff --git a/tensorflow/docs_src/programmers_guide/keras.md b/tensorflow/docs_src/programmers_guide/keras.md
index 6a9df12a25..c6aca7ebf4 100644
--- a/tensorflow/docs_src/programmers_guide/keras.md
+++ b/tensorflow/docs_src/programmers_guide/keras.md
@@ -1,334 +1,304 @@
# Keras
-## What's Keras?
-
-Keras is a high-level API specification for building and training deep learning
-models, suitable for fast prototyping, advanced research, and production.
-It offers three key advantages:
-
-- **User friendliness.** Keras follows best practices for reducing
- cognitive load: it offers consistent & simple interfaces,
- it minimizes the number of user actions required for common use cases,
- and it provides clear and actionable feedback upon user error.
-- **Modularity and composability.** A Keras model is composed of
- fully-configurable building blocks that can be plugged together
- with as few restrictions as possible -- like Lego bricks.
-- **Easy extensibility.** You can easily write your own building blocks
- (such as new layers, new loss functions, new models where you write
- the forward pass from scratch). This allows for total expressiveness,
- making Keras suitable for advanced research.
-
-
-## What's tf.keras?
-
-`tf.keras` is TensorFlow's implementation of the Keras API specification, that
-serves as the TensorFlow high-level API: it's how you build models in TensorFlow.
-`tf.keras` seamlessly integrates with the rest of the TensorFlow API
-(such as `tf.data` input pipelines), bringing you the full power and flexibility
-of TensorFlow through an easy-to-use interface.
-
-You can import `tf.keras` via:
+Keras is a high-level API to build and train deep learning models. It's used for
+fast prototyping, advanced research, and production, with three key advantages:
+
+- *User friendly*
+ Keras has a simple, consistent interface optimized for common use cases. It
+ provides clear and actionable feedback for user errors.
+- *Modular and composable*
+ Keras models are made by connecting configurable building blocks together,
+ with few restrictions.
+- *Easy to extend*
Write custom building blocks to express new ideas for
+ research. Create new layers, loss functions, and develop state-of-the-art
+ models.
+
+## Import tf.keras
+
+`tf.keras` is TensorFlow's implementation of the
+[Keras API specification](https://keras.io){:.external}. This is a high-level
+API to build and train models that includes first-class support for
+TensorFlow-specific functionality, such as [eager execution](#eager_execution),
+`tf.data` pipelines, and [Estimators](/programmers_guide/estimators).
+`tf.keras` makes TensorFlow easier to use without sacrificing flexibility and
+performance.
+
+To get started, import `tf.keras` as part of your TensorFlow program setup:
```python
+import tensorflow as tf
from tensorflow import keras
```
-What follows is a quick introduction to the basics of `tf.keras`.
+`tf.keras` can run any Keras-compatible code, but keep in mind:
+* The `tf.keras` version in the latest TensorFlow release might not be the same
+ as the latest `keras` version from PyPI. Check `tf.keras.__version__`.
+* When [saving a model's weights](#weights_only), `tf.keras` defaults to the
+ [checkpoint format](/get_started/checkpoints). Pass `save_format='h5'` to use
+ HDF5.
-## Table of contents
+## Build a simple model
-- [Getting started: the Sequential model](#getting-started-the-sequential-model)
-- [Configuring layers](#configuring-layers)
-- [Configuring training](#configuring-training)
-- [Training and evaluation](#training-and-evaluation)
-- [Building advanced models: the functional API](#building-advanced-models-the-functional-api)
-- [Building fully-customizable research models: the Model subclassing API](#building-fully-customizable-research-models-the-model-subclassing-api)
-- [Callbacks](#callbacks)
-- [Saving and serialization](#saving-and-serialization)
-- [Developing custom layers](#developing-custom-layers)
-- [Eager execution](#eager-execution)
-- [Further reading](#further-reading)
-- [FAQ](#faq)
+### Sequential model
+In Keras, you assemble *layers* to build *models*. A model is (usually) a graph
+of layers. The most common type of model is a stack of layers: the
+`tf.keras.Sequential` model.
----
-
-## Getting started: the Sequential model
-
-In `tf.keras`, you're assembling together **layers** to build **models**.
-A model is generally a graph of layers.
-The most common type of model is just a stack of layers: the `Sequential` class.
-
-Here's how to build a simple fully-connected network (multi-layer perceptron):
+To build a simple, fully-connected network (i.e. multi-layer perceptron):
```python
-from tensorflow import keras
-from tensorflow.keras import layers
-
model = keras.Sequential()
-# This adds to the model a densely-connected layer with 64 units:
-model.add(Dense(64, activation='relu'))
-# Another one:
-model.add(Dense(64, activation='relu'))
-# This adds a softmax layer with 10 output units:
-model.add(Dense(10, activation='softmax'))
+# Adds a densely-connected layer with 64 units to the model:
+model.add(keras.layers.Dense(64, activation='relu'))
+# Add another:
+model.add(keras.layers.Dense(64, activation='relu'))
+# Add a softmax layer with 10 output units:
+model.add(keras.layers.Dense(10, activation='softmax'))
```
----
-
-## Configuring layers
-
-Each layer may have unique constructor arguments, but some common arguments include:
+### Configure the layers
-- `activation`: the activation function to be used.
- It could be specified by name, as a string (for built-in functions)
- or as a callable object. By default, no activation is applied.
-- `kernel_initializer` and `bias_initializer`: the initialization schemes to use
- to create the layer's weights (kernel and bias).
- Likewise, they may be passed either by name or by specifying a callable.
- By default, the "Glorot uniform" initializer is used.
-- `kernel_regularizer` and `bias_regularizer`: the regularization schemes to
- apply to the layer's weights (kernel and bias), such as L1
- or L2 regularization. By default, no regularization is applied.
+There are many `tf.keras.layers` available with some common constructor
+parameters:
+* `activation`: Set the activation function for the layer. This parameter is
+ specified by the name of a built-in function or as a callable object. By
+ default, no activation is applied.
+* `kernel_initializer` and `bias_initializer`: The initialization schemes
+ that create the layer's weights (kernel and bias). This parameter is a name or
+ a callable object. This defaults to the `"Glorot uniform"` initializer.
+* `kernel_regularizer` and `bias_regularizer`: The regularization schemes
+ that apply the layer's weights (kernel and bias), such as L1 or L2
+ regularization. By default, no regularization is applied.
-### Examples
+The following instantiates `tf.keras.layers.Dense` layers using constructor
+arguments:
```python
-import tensorflow as tf
-from tensorflow.keras.layers import Dense
-from tensorflow.keras import regularizers
-from tensorflow.keras import initializers
-
-# A sigmoid layer:
-Dense(64, activation='sigmoid')
-# Another way to define the same sigmoid layer:
-Dense(64, activation=tf.sigmoid)
-
-# A linear layer with L1 regularization of factor 0.01
-# applied to the kernel matrix:
-Dense(64, kernel_regularizer=regularizers.l1(0.01))
-# A linear layer with L2 regularization of factor 0.01
-# applied to the bias vector:
-Dense(64, bias_regularizer=regularizers.l2(0.01))
+# Create a sigmoid layer:
+layers.Dense(64, activation='sigmoid')
+# Or:
+layers.Dense(64, activation=tf.sigmoid)
+
+# A linear layer with L1 regularization of factor 0.01 applied to the kernel matrix:
+layers.Dense(64, kernel_regularizer=keras.regularizers.l1(0.01))
+# A linear layer with L2 regularization of factor 0.01 applied to the bias vector:
+layers.Dense(64, bias_regularizer=keras.regularizers.l2(0.01))
# A linear layer with a kernel initialized to a random orthogonal matrix:
-Dense(64, kernel_initializer='orthogonal')
+layers.Dense(64, kernel_initializer='orthogonal')
# A linear layer with a bias vector initialized to 2.0s:
-Dense(64, bias_initializer=initializers.constant(2.0))
+layers.Dense(64, bias_initializer=keras.initializers.constant(2.0))
```
----
+## Train and evaluate
-## Configuring training
+### Set up training
-Once your model looks good, configure its learning process by calling `compile`:
+After the model is constructed, configure its learning process by calling the
+`compile` method:
```python
-import tensorflow as tf
-
model.compile(optimizer=tf.train.AdamOptimizer(0.001),
loss='categorical_crossentropy',
metrics=['accuracy'])
```
-There are three key arguments that you need to specify:
+`tf.keras.Model.compile` takes three important arguments:
-- An `optimizer`: this object specifies the training procedure.
- We recommend that you pass instances of optimizers from the `tf.train` module
- (such as [`AdamOptimizer`](https://www.tensorflow.org/api_docs/python/tf/train/AdamOptimizer),
- [`RMSPropOptimizer`](https://www.tensorflow.org/api_docs/python/tf/train/RMSPropOptimizer),
- or [`GradientDescentOptimizer`](https://www.tensorflow.org/api_docs/python/tf/train/GradientDescentOptimizer)).
-- A `loss` function to minimize: this specifies the optimization objective.
- Common choices include mean square error (`mse`), `categorical_crossentropy`
- and `binary_crossentropy`. Loss functions may be specified by name
- or by passing a callable (e.g. from the `tf.keras.losses` module).
-- Some `metrics` to monitor during training: again, you can pass these as either
- string names or callables (e.g. from the `tf.keras.metrics` module).
+* `optimizer`: This object specifies the training procedure. Pass it optimizer
+ instances from the `tf.train` module, such as
+ [`AdamOptimizer`](/api_docs/python/tf/train/AdamOptimizer),
+ [`RMSPropOptimizer`](/api_docs/python/tf/train/RMSPropOptimizer), or
+ [`GradientDescentOptimizer`](/api_docs/python/tf/train/GradientDescentOptimizer).
+* `loss`: The function to minimize during optimization. Common choices include
+ mean square error (`mse`), `categorical_crossentropy`, and
+ `binary_crossentropy`. Loss functions are specified by name or by
+ passing a callable object from the `tf.keras.losses` module.
+* `metrics`: Used to monitor training. These are string names or callables from
+ the `tf.keras.metrics` module.
-
-### Examples
+The following shows a few examples of configuring a model for training:
```python
-# Configures a model to do mean-squared error regression.
+# Configure a model for mean-squared error regression.
model.compile(optimizer=tf.train.AdamOptimizer(0.01),
- loss='mse', # mean squared error
+ loss='mse', # mean squared error
metrics=['mae']) # mean absolute error
-```
-```python
-# Configures a model to do categorical classification.
+
+# Configure a model for categorical classification.
model.compile(optimizer=tf.train.RMSPropOptimizer(0.01),
- loss=tf.keras.losses.categorical_crossentropy,
- metrics=[tf.keras.metrics.categorical_accuracy])
+ loss=keras.losses.categorical_crossentropy,
+ metrics=[keras.metrics.categorical_accuracy])
```
----
-
-## Training and evaluation
+### Input NumPy data
-### From Numpy data
-
-When running locally on small datasets, the easiest way to do training and
-evaluation is to pass data to your model as Numpy arrays of inputs and targets.
-You can "fit" your model to some training data using the `model.fit()` method:
+For small datasets, use in-memory [NumPy](https://www.numpy.org/){:.external}
+arrays to train and evaluate a model. The model is "fit" to the training data
+using the `fit` method:
```python
import numpy as np
-data = np.random.random(shape=(1000, 32))
-targets = np.random.random(shape=(1000, 10))
+data = np.random.random((1000, 32))
+labels = np.random.random((1000, 10))
-model.fit(data, targets, epochs=10, batch_size=32)
+model.fit(data, labels, epochs=10, batch_size=32)
```
-Here are some key arguments you can pass to the `fit` method:
-
-- `epochs`: Training is structured into **epochs**. An epoch is one iteration
- over the entire input data (which is done in smaller batches).
-- `batch_size`: when passing Numpy data, the model will slice the data into
- smaller batches and iterate over these batches during training.
- This integer specifies the size of each batch
- (the last batch may be smaller if the total number of samples is not
- divisible by the batch size).
-- `validation_data`: when prototyping a model, you want to be able to quickly
- monitor its performance on some validation data.
- When you pass this argument (it expects a tuple of inputs and targets),
- the model will display the loss and metrics in inference mode on the data
- you passed, at the end of each epoch.
+`tf.keras.Model.fit` takes three important arguments:
+
+* `epochs`: Training is structured into *epochs*. An epoch is one iteration over
+ the entire input data (this is done in smaller batches).
+* `batch_size`: When passed NumPy data, the model slices the data into smaller
+ batches and iterates over these batches during training. This integer
+ specifies the size of each batch. Be aware that the last batch may be smaller
+ if the total number of samples is not divisible by the batch size.
+* `validation_data`: When prototyping a model, you want to easily monitor its
+ performance on some validation data. Passing this argument—a tuple of inputs
+ and labels—allows the model to display the loss and metrics in inference mode
+ for the passed data, at the end of each epoch.
Here's an example using `validation_data`:
```python
import numpy as np
-data = np.random.random(shape=(1000, 32))
-targets = np.random.random(shape=(1000, 10))
+data = np.random.random((1000, 32))
+labels = np.random.random((1000, 10))
-val_data = np.random.random(shape=(100, 32))
-val_targets = np.random.random(shape=(100, 10))
+val_data = np.random.random((100, 32))
+val_labels = np.random.random((100, 10))
-model.fit(data, targets, epochs=10, batch_size=32,
- validation_data=(val_data, val_targets))
+model.fit(data, labels, epochs=10, batch_size=32,
+ validation_data=(val_data, val_labels))
```
-### From tf.data datasets
+### Input tf.data datasets
-When you need to scale to large datasets or multi-device training,
-training from Numpy arrays in memory will not be ideal.
-In such cases, you should use [the `tf.data` API](https://www.tensorflow.org/programmers_guide/datasets).
-You can pass a `tf.data.Dataset` instance to the `fit` method:
+Use the [Datasets API](/programmers_guide/datasets) to scale to large datasets
+or multi-device training. Pass a `tf.data.Dataset` instance to the `fit`
+method:
```python
-import tensorflow as tf
-
# Instantiates a toy dataset instance:
-dataset = tf.data.Dataset.from_tensor_slices((data, targets)).batch(32)
+dataset = tf.data.Dataset.from_tensor_slices((data, labels))
+dataset = dataset.batch(32)
+dataset = dataset.repeat()
# Don't forget to specify `steps_per_epoch` when calling `fit` on a dataset.
model.fit(dataset, epochs=10, steps_per_epoch=30)
```
-When doing so, the dataset itself will yield batches of data,
-so the model does not need to be passed `batch_size` information.
-Instead, the model needs to know for how many steps (or batches of data)
-it should run at each epoch.
-You specify this with the `steps_per_epoch` argument: it's the number of
-training steps the model will run before moving on the next epoch.
+Here, the `fit` method uses the `steps_per_epoch` argument—this is the number of
+training steps the model runs before it moves to the next epoch. Since the
+`Dataset` yields batches of data, this snippet does not require a `batch_size`.
-You can also pass datasets for validation:
+Datasets can also be used for validation:
```python
-dataset = tf.data.Dataset.from_tensor_slices((data, targets)).batch(32)
-val_dataset = tf.data.Dataset.from_tensor_slices((val_data, val_targets)).batch(32)
+dataset = tf.data.Dataset.from_tensor_slices((data, labels))
+dataset = dataset.batch(32).repeat()
-model.fit(dataset, epochs=10, steps_per_epoch=30, validation_data=val_dataset, validation_steps=3)
+val_dataset = tf.data.Dataset.from_tensor_slices((val_data, val_labels))
+val_dataset = val_dataset.batch(32).repeat()
+
+model.fit(dataset, epochs=10, steps_per_epoch=30,
+ validation_data=val_dataset,
+ validation_steps=3)
```
### Evaluate and predict
-In addition, you get access to the following methods
-(both with Numpy data and dataset instances):
+The `tf.keras.Model.evaluate` and `tf.keras.Model.predict` methods can use NumPy
+data and a `tf.data.Dataset`.
-- `model.evaluate(x, y, batch_size=32)` or `model.evaluate(dataset, steps=30)`
- will return the inference-mode loss and metrics for the data provided.
-- `model.predict(x, y, batch_size=32)` or `model.predict(dataset, steps=30)`
- will return the output(s) of the last layer(s) in inference on the data
- provided, as Numpy array(s).
+To *evaluate* the inference-mode loss and metrics for the data provided:
----
+```python
+model.evaluate(x, y, batch_size=32)
-## Building advanced models: the functional API
+model.evaluate(dataset, steps=30
+```
-The `Sequential` model cannot represent arbitrary models -- only simple stacks
-of layers. If you need to use more complex model topologies,
-such as multi-input models, multi-output models,
-models with a same layer called several times (shared layers),
-or models with non-sequential data flows (e.g. residual connections),
-you can use the 'functional API'.
+And to *predict* the output of the last layer in inference for the data provided,
+as a NumPy array:
-Here's how it works:
+```
+model.predict(x, batch_size=32)
-- A layer instance is callable (on a tensor), and it returns a tensor.
-- Input tensor(s) and output tensor(s) can then be used to define a `Model` instance.
-- Such a model can be trained just like the `Sequential` model.
+model.predict(dataset, steps=30)
+```
-Here's a basic example showing the same model we previously defined,
-built using the functional API:
+## Build advanced models
-```python
-from tensorflow import keras
-from tensorflow.keras import layers
+### Functional API
-# This returns a placeholder tensor:
-inputs = keras.Input(shape=(784,))
+The `tf.keras.Sequential` model is a simple stack of layers that cannot
+represent arbitrary models. Use the
+[Keras functional API](https://keras.io/getting-started/functional-api-guide/){:.external}
+to build complex model topologies such as:
+
+* Multi-input models,
+* Multi-output models,
+* Models with shared layers (the same layer called several times),
+* Models with non-sequential data flows (e.g. residual connections).
+
+Building a model with the functional API works like this:
+
+1. A layer instance is callable and returns a tensor.
+2. Input tensors and output tensors are used to define a `tf.keras.Model`
+ instance.
+3. This model is trained just like the `Sequential` model.
+
+The following example uses the functional API to build a simple, fully-connected
+network:
+
+```python
+inputs = keras.Input(shape=(32,)) # Returns a placeholder tensor
# A layer instance is callable on a tensor, and returns a tensor.
-x = layers.Dense(64, activation='relu')(inputs)
-x = layers.Dense(64, activation='relu')(x)
-predictions = layers.Dense(10, activation='softmax')(x)
+x = keras.layers.Dense(64, activation='relu')(inputs)
+x = keras.layers.Dense(64, activation='relu')(x)
+predictions = keras.layers.Dense(10, activation='softmax')(x)
-# Instantiates the model given inputs and outputs.
+# Instantiate the model given inputs and outputs.
model = keras.Model(inputs=inputs, outputs=predictions)
-# The "compile" step specifies the training configuration.
-model.compile(optimizer='rmsprop',
+# The compile step specifies the training configuration.
+model.compile(optimizer=tf.train.RMSPropOptimizer(0.001),
loss='categorical_crossentropy',
metrics=['accuracy'])
-# Trains for 5 epochs.
+# Trains for 5 epochs
model.fit(data, labels, batch_size=32, epochs=5)
```
-This API enables you to create models with multiple inputs and outputs,
-and to "share" layers across different inputs
-(i.e. to reuse a same instance multiple times).
-For examples of these use cases,
-please see [this guide to the functional API in Keras](https://keras.io/getting-started/functional-api-guide/).
+### Model subclassing
----
+Build a fully-customizable model by subclassing `tf.keras.Model` and defining
+your own forward pass. Create layers in the `__init__` method and set them as
+attributes of the class instance. Define the forward pass in the `call` method.
-## Building fully-customizable research models: the Model subclassing API
+Model subclassing is particularly useful when
+[eager execution](/programmers_guide/eager) is enabled since the forward pass
+can be written imperatively.
-Besides `Sequential` and the functional API, one last, more flexible way to
-define models is to directly subclass the `Model` class and define your own
-forward pass manually.
+Key Point: Use the right API for the job. While model subclassing offers
+flexibility, it comes at a cost of greater complexity and more opportunities for
+user errors. If possible, prefer the functional API.
-In this API, you instante layers in `__init__` and set them as attribute of the
-class instance. Then you specify the forward pass in `call`.
-This API is particularly valuable when using TensorFlow with [eager execution](https://www.tensorflow.org/programmers_guide/eager),
-since eager execution allows you to write your forward pass in an
-imperative fashion (as if you were writing Numpy code, for instance).
+The following example shows a subclassed `tf.keras.Model` using a custom forward
+pass:
```python
-import tensorflow as tf
-from tensorflow import keras
-
-
class MyModel(keras.Model):
- def __init__(self, num_classes=2):
+ def __init__(self, num_classes=10):
super(MyModel, self).__init__(name='my_model')
self.num_classes = num_classes
# Define your layers here.
@@ -351,10 +321,10 @@ class MyModel(keras.Model):
# Instantiates the subclassed model.
-model = MyModel(num_classes=2)
+model = MyModel(num_classes=10)
-# The "compile" step specifies the training configuration.
-model.compile(optimizer='rmsprop',
+# The compile step specifies the training configuration.
+model.compile(optimizer=tf.train.RMSPropOptimizer(0.001),
loss='categorical_crossentropy',
metrics=['accuracy'])
@@ -362,353 +332,291 @@ model.compile(optimizer='rmsprop',
model.fit(data, labels, batch_size=32, epochs=5)
```
-**Remember:** use the right API for the right job.
-Using the `Model` subclassing API offers more flexibility,
-but at the cost of greater complexity and a larger potential user error surface.
-Prefer using the functional API when possible.
----
+### Custom layers
-## Callbacks
+Create a custom layer by subclassing `tf.keras.layers.Layer` and implementing
+the following methods:
-Callbacks are objects that you can pass to your model that customize and extend
-its behavior during training.
-There are callbacks for saving checkpoints of your model at regular intervals
-(`tf.keras.callbacks.ModelCheckpoint`),
-to dynamically change the learning rate (`tf.keras.callbacks.LearningRateScheduler`)
-or to interrupt training when validation performance has stopped improving
-(`tf.keras.callbacks.EarlyStopping`).
-You can also use a callback to monitor your model's behavior using
-[TensorBoard](https://www.tensorflow.org/programmers_guide/summaries_and_tensorboard)
-(`tf.keras.callbacks.TensorBoard`).
-You can also write your own custom callbacks.
-
-Different built-in callback are found in `tf.keras.callbacks`.
-You use them by passing a `Callback` instance to `fit`:
+* `build`: Create the weights of the layer. Add weights with the `add_weight`
+ method.
+* `call`: Define the forward pass.
+* `compute_output_shape`: Specify how to compute the output shape of the layer
+ given the input shape.
+* Optionally, a layer can be serialized by implementing the `get_config` method
+ and the `from_config` class method.
+
+Here's an example of a custom layer that implements a `matmul` of an input with
+a kernel matrix:
```python
-from tensorflow import keras
+class MyLayer(keras.layers.Layer):
+
+ def __init__(self, output_dim, **kwargs):
+ self.output_dim = output_dim
+ super(MyLayer, self).__init__(**kwargs)
+
+ def build(self, input_shape):
+ shape = tf.TensorShape((input_shape[1], self.output_dim))
+ # Create a trainable weight variable for this layer.
+ self.kernel = self.add_weight(name='kernel',
+ shape=shape,
+ initializer='uniform',
+ trainable=True)
+ # Be sure to call this at the end
+ super(MyLayer, self).build(input_shape)
-callbacks = [
- # Interrupt training if `val_loss` stops improving for over 2 epochs
- keras.callbacks.EarlyStopping(patience=2, monitor='val_loss'),
- # Write TensorBoard logs to `./logs` directory
- keras.callbacks.TensorBoard(log_dir='./logs')
-]
-model.fit(data, labels, batch_size=32, epochs=5, callbacks=callbacks)
-```
+ def call(self, inputs):
+ return tf.matmul(inputs, self.kernel)
----
+ def compute_output_shape(self, input_shape):
+ shape = tf.TensorShape(input_shape).as_list()
+ shape[-1] = self.output_dim
+ return tf.TensorShape(shape)
-## Saving and serialization
+ def get_config(self):
+ base_config = super(MyLayer, self).get_config()
+ base_config['output_dim'] = self.output_dim
-### Weights-only saving
+ @classmethod
+ def from_config(cls, config):
+ return cls(**config)
-You can save the weight values of a model via `model.save_weights(filepath)`:
-```python
-# Saves weights to a SavedModel file.
-model.save_weights('my_model')
+# Create a model using the custom layer
+model = keras.Sequential([MyLayer(10),
+ keras.layers.Activation('softmax')])
-# Restores the model's state
-# (this requires a model that has the same architecture).
-model.load_weights('my_model')
+# The compile step specifies the training configuration
+model.compile(optimizer=tf.train.RMSPropOptimizer(0.001),
+ loss='categorical_crossentropy',
+ metrics=['accuracy'])
+
+# Trains for 5 epochs.
+model.fit(data, targets, batch_size=32, epochs=5)
```
-By default, this saves the weight in the TensorFlow
-[`SavedModel`](https://www.tensorflow.org/programmers_guide/saved_model) format.
-You could also save them in the Keras HDF5 format
-(which is the default in the multi-backend implementation of Keras):
-```python
-# Saves weights to a HDF5 file.
-model.save_weights('my_model.h5', format='h5')
+## Callbacks
-# Restores the model's state.
-model.load_weights('my_model.h5')
-```
+A callback is an object passed to a model to customize and extend its behavior
+during training. You can write your own custom callback, or use the built-in
+`tf.keras.callbacks` that include:
-### Configuration-only saving (serialization)
+* `tf.keras.callbacks.ModelCheckpoint`: Save checkpoints of your model at
+ regular intervals.
+* `tf.keras.callbacks.LearningRateScheduler`: Dynamically change the learning
+ rate.
+* `tf.keras.callbacks.EarlyStopping`: Interrupt training when validation
+ performance has stopped improving.
+* `tf.keras.callbacks.TensorBoard`: Monitor the model's behavior using
+ [TensorBoard](/programmers_guide/summaries_and_tensorboard).
-You can also save the model's configuration
-(its architecture, without any weight values),
-which allows you to recreate the same model later (freshly initialized) even if
-you don't have the code that defined it anymore.
-Two possible serialization formats are JSON and YAML:
+To use a `tf.keras.callbacks.Callback`, pass it to the model's `fit` method:
```python
-from tensorflow.keras import models
-
-# Serializes a model to JSON.
-json_string = model.to_json()
-# Recreates the model (freshly initialized).
-fresh_model = models.from_json(json_string)
-
-# Serializes a model to YAML.
-yaml_string = model.to_yaml()
-# Recreates the model.
-fresh_model = models.from_yaml(yaml_string)
+callbacks = [
+ # Interrupt training if `val_loss` stops improving for over 2 epochs
+ keras.callbacks.EarlyStopping(patience=2, monitor='val_loss'),
+ # Write TensorBoard logs to `./logs` directory
+ keras.callbacks.TensorBoard(log_dir='./logs')
+]
+model.fit(data, labels, batch_size=32, epochs=5, callbacks=callbacks,
+ validation_data=(val_data, val_targets))
```
-Note that this feature is not available with subclassed models,
-because they are simply not serializable:
-their architecture is defined as Python code
-(the body of the `call` method of the model).
-### Whole-model saving
+## Save and restore
-Finally, you can also save a model wholesale, to a file that will contain both
-the weight values, the model's configuration,
-and even the optimizer's configuration.
-The allows you to checkpoint a model and resume training later --
-from the exact same state -- even if you don't have access to the original code.
+### Weights only
-```python
-from tensorflow.keras import models
+Save and load the weights of a model using `tf.keras.Model.save_weights`:
-model.save('my_model.h5')
+```python
+# Save weights to a TensorFlow Checkpoint file
+model.save_weights('./my_model')
-# Recreates the exact same model, complete with weights and optimizer.
-model = models.load_model('my_model.h5')
+# Restore the model's state,
+# this requires a model with the same architecture.
+model.load_weights('my_model')
```
----
-
-## Developing custom layers
-
-You can write your own custom layers by subclassing the class
-`tf.keras.layers.Layer`. You will need to implement the following three methods:
-
-- `build`: Creates the weights of the layer.
- Weights should be added via the `add_weight` method.
-- `call`: Specifies the forward pass.
-- `compute_output_shape`: Specifies how to compute the output shape of the layer
- given the input shape.
-
-Optionally, you may also implement the method `get_config()` and the
-class method `from_config()` if you want your layer to be serializable.
-
-Here's a simple example of a custom layer that implements a `matmul`
-of an input with a kernel matrix:
+By default, this saves the model's weights in the
+[TensorFlow checkpoint](/get_started/checkpoints) file format. Weights can also
+be saved to the Keras HDF5 format (the default for the multi-backend
+implementation of Keras):
```python
-import tensorflow as tf
-from tensorflow.keras import layers
-
-class MyLayer(layers.Layer):
-
- def __init__(self, output_dim, **kwargs):
- self.output_dim = output_dim
- super(MyLayer, self).__init__(**kwargs)
-
- def build(self, input_shape):
- # Create a trainable weight variable for this layer.
- self.kernel = self.add_weight(name='kernel',
- shape=(input_shape[1], self.output_dim),
- initializer='uniform',
- trainable=True)
- # Be sure to call this at the end
- super(MyLayer, self).build(input_shape)
-
- def call(self, inputs):
- return tf.matmul(inputs, self.kernel)
-
- def compute_output_shape(self, input_shape):
- shape = tf.TensorShape(input_shape).as_list()
- shape[-1] = self.output_dim
- return tf.TensorShape(shape)
-
- def get_config(self):
- base_config = super(MyLayer, self).get_config()
- base_config['output_dim'] = self.output_dim
-
- @classmethod
- def from_config(cls, config):
- return cls(**config)
-```
+# Save weights to a HDF5 file
+model.save_weights('my_model.h5', save_format='h5')
----
-
-## Eager execution
+# Restore the model's state
+model.load_weights('my_model.h5')
+```
-[Eager execution](https://www.tensorflow.org/programmers_guide/eager)
-is a way to write TensorFlow code imperatively.
-All three `tf.keras` model-building APIs
-(`Sequential`, the functional API `Model(inputs, outputs)`,
-and the subclassing API `MyModel(Model)`) are compatible with eager execution.
-When using `Sequential` or the functional API, it makes no difference to the
-user experience whether the model is executing eagerly or not.
-Eager execution is most beneficial when used with the `Model` subclassing API,
-or when prototyping a custom layer -- that is to say, in APIs that require you
-to *write a forward pass as code*, rather than in APIs that allow you to create
-models by assembling together existing layers.
+### Configuration only
-While the same training and evaluating APIs presented in this guide work
-as usual with eager execution, you can in addition
-write custom training loops using the eager `GradientTape`
-and define-by-run autodifferentiation:
+A model's configuration can be saved—this serializes the model architecture
+without any weights. A saved configuration can recreate and initialize the same
+model, even without the code that defined the original model. Keras supports
+JSON and YAML serialization formats:
```python
-import tensorflow as tf
-from tensorflow.contrib import eager as tfe
-
-# This call begins the eager execution session.
-tf.enable_eager_execution()
-
-model = ... # Defines a Keras model (we recommend Model subclassing in this case).
-dataset = ... # Defines a `tf.data` dataset.
+# Serialize a model to JSON format
+json_string = model.to_json()
-optimizer = tf.train.AdamOptimizer(0.01)
+# Recreate the model (freshly initialized)
+fresh_model = keras.models.from_json(json_string)
-for data, labels in dataset:
- # Runs the forward pass and loss computation under a `GradientTape` scope,
- # which will record all operations in order to prepare for the backward pass.
- with tfe.GradientTape() as tape:
- predictions = model(data)
- loss = loss_function(labels, predictions)
+# Serializes a model to YAML format
+yaml_string = model.to_yaml()
- # Runs the backward pass manually using the operations recorded
- # by the gradient tape.
- grads = tape.gradient(loss, model.trainable_weights)
- optimizer.apply_gradients(zip(grads, model.trainable_weights),
- global_step=tf.train.get_or_create_global_step())
+# Recreate the model
+fresh_model = keras.models.from_yaml(yaml_string)
```
----
+Caution: Subclassed models are not serializable because their architecture is
+defined by the Python code in the body of the `call` method.
-## Further reading
-### Documentation
+### Entire model
-- [tf.keras documentation](https://www.tensorflow.org/api_docs/python/tf/keras)
-- [keras.io](https://keras.io/)
+The entire model can be saved to a file that contains the weight values, the
+model's configuration, and even the optimizer's configuration. This allows you
+to checkpoint a model and resume training later—from the exact same
+state—without access to the original code.
-### tf.keras tutorials and examples
-
-- [Fashion-MNIST with tf.Keras](https://medium.com/tensorflow/hello-deep-learning-fashion-mnist-with-keras-50fcff8cd74a)
-- [Predicting the price of wine with the Keras Functional API and TensorFlow](
- https://medium.com/tensorflow/predicting-the-price-of-wine-with-the-keras-functional-api-and-tensorflow-a95d1c2c1b03)
+```python
+# Create a trivial model
+model = keras.Sequential([
+ keras.layers.Dense(10, activation='softmax', input_shape=(32,)),
+ keras.layers.Dense(10, activation='softmax')
+])
+model.compile(optimizer='rmsprop',
+ loss='categorical_crossentropy',
+ metrics=['accuracy'])
+model.fit(data, targets, batch_size=32, epochs=5)
----
+# Save entire model to a HDF5 file
+model.save('my_model.h5')
-## FAQ
+# Recreate the exact same model, including weights and optimizer.
+model = keras.models.load_model('my_model.h5')
+```
-### What are the differences between tf.keras and the multi-backend Keras implementation?
-`tf.keras` includes first-class support for important TensorFlow-specific
-functionality not found in other Keras implementations, in particular:
+## Eager execution
-- Support for eager execution.
-- Support for the `tf.data` API.
-- Integration with the
- [`tf.estimator` API](https://www.tensorflow.org/programmers_guide/estimators),
- via `tf.keras.estimator.model_to_estimator`.
+[Eager execution](/programmers_guide/eager) is an imperative programming
+environment that evaluates operations immediately. This is not required for
+Keras, but is supported by `tf.keras` and useful for inspecting your program and
+debugging.
-In terms of API differences: `tf.keras` is a full implementation of the
-Keras API, so any code targeting the Keras API will run on `tf.keras`.
-However, keep in mind that:
+All of the `tf.keras` model-building APIs are compatible with eager execution.
+And while the `Sequential` and functional APIs can be used, eager execution
+especially benefits *model subclassing* and building *custom layers*—the APIs
+that require you to write the forward pass as code (instead of the APIs that
+create models by assembling existing layers).
-- The `tf.keras` API version in the latest TensorFlow release might not be the
- same as the latest `keras` version from PyPI.
- Check out `tf.keras.__version__` if in doubt.
-- In `tf.keras`, the default file format saved by `model.save_weights` is the
- TensorFlow `SavedModel` format.
- To use HDF5, you can pass the `format='h5'` argument.
+See the [eager execution guide](/programmers_guide/eager#build_a_model) for
+examples of using Keras models with custom training loops and `tf.GradientTape`.
-### What is the relationship between tf.keras and tf.estimator?
+## Distribution
-The [`tf.estimator` API](https://www.tensorflow.org/programmers_guide/estimators)
-is a high-level TensorFlow API for training "estimator" models,
-in particular in distributed settings.
-This API targets industry use cases, such as distributed training
-on large datasets with a focus on eventually exporting a production model.
+### Estimators
-If you have a `tf.keras` model that would like to train with the `tf.estimator`
-API, you can convert your model to an `Estimator` object via the
-`model_to_estimator` utility](https://www.tensorflow.org/programmers_guide/estimators#creating_estimators_from_keras_models):
+The [Estimators](/programmers_guide/estimators) API is used for training models
+for distributed environments. This targets industry use cases such as
+distributed training on large datasets that can export a model for production.
+A `tf.keras.Model` can be trained with the `tf.estimator` API by converting the
+model to an `tf.estimator.Estimator` object with
+`tf.keras.estimator.model_to_estimator`. See
+[Creating Estimators from Keras models](/programmers_guide/estimators#creating_estimators_from_keras_models).
```python
-estimator = tf.keras.estimator.model_to_estimator(model)
-```
+model = keras.Sequential([layers.Dense(10,activation='softmax'),
+ layers.Dense(10,activation='softmax')])
-When using `model_to_estimator`, enabling eager execution is helpful for
-developing and debugging your `input_fn`
-(as it allows you to easily print your data).
+model.compile(optimizer=tf.train.RMSPropOptimizer(0.001),
+ loss='categorical_crossentropy',
+ metrics=['accuracy'])
+
+estimator = keras.estimator.model_to_estimator(model)
+```
+Note: Enable [eager execution](/programmers_guide/eager) for debugging
+[Estimator input functions](/programmers_guide/premade_estimators#create_input_functions)
+and inspecting data.
-### How can I run tf.keras models on multiple GPUs?
+### Multiple GPUs
-You can run tf.keras models on multiple GPUs using the
-[`DistributionStrategy API`](https://www.tensorflow.org/versions/master/api_docs/python/tf/contrib/distribute/DistributionStrategy).
-The `DistributionStrategy` API allow you to distribute training on multiple GPUs
-with almost no changes to your existing code.
+`tf.keras` models can run on multiple GPUs using
+`tf.contrib.distribute.DistributionStrategy`. This API provides distributed
+training on multiple GPUs with almost no changes to existing code.
-Currently [`MirroredStrategy`](https://www.tensorflow.org/versions/master/api_docs/python/tf/contrib/distribute/MirroredStrategy)
-is the only supported strategy.
-`MirroredStrategy` allows you to do in-graph replication with synchronous
-training using all-reduce on a single machine.
-To use `DistributionStrategy` with a `tf.keras` model,
-you can use the `model_to_estimator` utility to convert a `tf.keras` model to
-an `Estimator` and then train the estimator.
+Currently, `tf.contrib.distribute.MirroredStrategy` is the only supported
+distribution strategy. `MirroredStrategy` does in-graph replication with
+synchronous training using all-reduce on a single machine. To use
+`DistributionStrategy` with Keras, convert the `tf.keras.Model` to a
+`tf.estimator.Estimator` with `tf.keras.estimator.model_to_estimator`, then
+train the estimator
-Here is a simple example of distributing a `tf.keras` model across multiple GPUs
-on a single machine.
+The following example distributes a `tf.keras.Model` across multiple GPUs on a
+single machine.
-Let's first define a simple model:
+First, define a simple model:
```python
-model = tf.keras.Sequential()
-model.add(tf.keras.layers.Dense(16, activation='relu', input_shape=(10,)))
-model.add(tf.keras.layers.Dense(1, activation='sigmoid'))
+model = keras.Sequential()
+model.add(keras.layers.Dense(16, activation='relu', input_shape=(10,)))
+model.add(keras.layers.Dense(1, activation='sigmoid'))
+
optimizer = tf.train.GradientDescentOptimizer(0.2)
+
model.compile(loss='binary_crossentropy', optimizer=optimizer)
model.summary()
```
-Let's use `model_to_estimator` to create an `Estimator` instance from the
-`tf.keras` model defined above.
+Convert the Keras model to a `tf.estimator.Estimator` instance:
```python
-keras_estimator = tf.keras.estimator.model_to_estimator(
- keras_model=model,
- config=config,
- model_dir='/tmp/model_dir')
+keras_estimator = keras.estimator.model_to_estimator(
+ keras_model=model,
+ config=config,
+ model_dir='/tmp/model_dir')
```
-We'll use `tf.data.Datasets` to define our input pipeline.
-Our `input_fn` returns a `tf.data.Dataset` object that we then use to distribute
-the data across multiple devices with each device processing
+Define an *input pipeline*. The `input_fn` returns a `tf.data.Dataset` object
+used to distribute the data across multiple devices—with each device processing
a slice of the input batch.
```python
def input_fn():
- x = np.random.random((1024, 10))
- y = np.random.randint(2, size=(1024, 1))
- x = tf.cast(x, tf.float32)
- dataset = tf.data.Dataset.from_tensor_slices((x, y))
- dataset = dataset.repeat(10)
- dataset = dataset.batch(32)
- return dataset
+ x = np.random.random((1024, 10))
+ y = np.random.randint(2, size=(1024, 1))
+ x = tf.cast(x, tf.float32)
+ dataset = tf.data.Dataset.from_tensor_slices((x, y))
+ dataset = dataset.repeat(10)
+ dataset = dataset.batch(32)
+ return dataset
```
-The next step is to create a `RunConfig` and set the train_distribute argument
-to the new `MirroredStrategy` instance.
-You can specify a list of devices or the `num_gpus` argument when creating
-a `MirroredStrategy` instance.
-Not specifying any arguments defaults to using all the available GPUs like we do
-in this example.
+Next, create a `tf.estimator.RunConfig` and set the `train_distribute` argument
+to the `tf.contrib.distribute.MirroredStrategy` instance. When creating
+`MirroredStrategy`, you can specify a list of devices or set the `num_gpus`
+argument. The default uses all available GPUs, like the following:
```python
strategy = tf.contrib.distribute.MirroredStrategy()
config = tf.estimator.RunConfig(train_distribute=strategy)
```
-Call train on the `Estimator` instance providing the `input_fn` and `steps`
-arguments as input:
+Finally, train the `Estimator` instance by providing the `input_fn` and `steps`
+arguments:
```python
keras_estimator.train(input_fn=input_fn, steps=10)
--
GitLab
From 7e859ebc65bf7d77ed89f736c7fd6fede0a93c92 Mon Sep 17 00:00:00 2001
From: Michael Case
Date: Mon, 18 Jun 2018 11:07:48 -0700
Subject: [PATCH 035/519] Add missing Eager relnotes for TensorFlow 1.9.
(#20101)
---
RELEASE.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/RELEASE.md b/RELEASE.md
index 879ce6e440..510eca5467 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -22,6 +22,8 @@
* (C++) `DatasetBase::MakeIterator()` has been renamed to `DatasetBase::MakeIteratorInternal()`.
* (C++) `IteratorBase::Initialize()` method was added to support raising errors during iterator construction.
* Eager Execution:
+ * Added the ability to pause recording operations for gradient computation via `tf.GradientTape.stop_recording`.
+ * Updated documentation, introductory notebooks.
* `tf.keras`:
* Move Keras code out of _impl folder and remove API files.
* `tf.keras.Model.save_weights` now saves in TensorFlow format by default.
--
GitLab
From 86a6b0d7efbe5a3fa1f511237b85c926a6aef3a5 Mon Sep 17 00:00:00 2001
From: Brennan Saeta
Date: Tue, 19 Jun 2018 17:47:37 -0700
Subject: [PATCH 036/519] [GCS] Typo in ConfigureGcsHook.
This commit fixes a typo on ConfigureGcsHook that prevented its correct
operation.
---
tensorflow/contrib/cloud/python/ops/gcs_config_ops.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tensorflow/contrib/cloud/python/ops/gcs_config_ops.py b/tensorflow/contrib/cloud/python/ops/gcs_config_ops.py
index 8c8c5acb31..4f7300fd1f 100644
--- a/tensorflow/contrib/cloud/python/ops/gcs_config_ops.py
+++ b/tensorflow/contrib/cloud/python/ops/gcs_config_ops.py
@@ -120,13 +120,17 @@ class ConfigureGcsHook(training.SessionRunHook):
def begin(self):
if self._credentials:
self._credentials_placeholder = array_ops.placeholder(dtypes.string)
- self._credentials_ops = gen_gcs_config_ops.gcs_configure_credentials(
+ self._credentials_op = gen_gcs_config_ops.gcs_configure_credentials(
self._credentials_placeholder)
+ else:
+ self._credentials_op = None
if self._block_cache:
self._block_cache_op = gen_gcs_config_ops.gcs_configure_block_cache(
max_cache_size=self._block_cache.max_bytes,
block_size=self._block_cache.block_size,
max_staleness=self._block_cache.max_staleness)
+ else:
+ self._block_cache_op = None
def after_create_session(self, session, coord):
del coord
--
GitLab
From fdbb80f217d3a153b4eda66c766df921b3f73ab4 Mon Sep 17 00:00:00 2001
From: Michael Case
Date: Wed, 20 Jun 2018 14:08:57 -0700
Subject: [PATCH 037/519] Move external/ directory in pip package.
Moving external/ directory in the pip packages (which is currently
installed directly into site-packages directory). Moving the
directory to tensorflow/include/external/. Also, removing all
python files from external (since it should really only contain
headers and license files.)
---
.../tools/pip_package/build_pip_package.sh | 21 ++++++++++++-------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/tensorflow/tools/pip_package/build_pip_package.sh b/tensorflow/tools/pip_package/build_pip_package.sh
index f7e42ce536..9e41514cfa 100755
--- a/tensorflow/tools/pip_package/build_pip_package.sh
+++ b/tensorflow/tools/pip_package/build_pip_package.sh
@@ -24,9 +24,15 @@ function real_path() {
function cp_external() {
local src_dir=$1
local dest_dir=$2
- for f in `find "$src_dir" -maxdepth 1 -mindepth 1 ! -name '*local_config_cuda*' ! -name '*local_config_tensorrt*' ! -name '*org_tensorflow*'`; do
- cp -R "$f" "$dest_dir"
+
+ pushd .
+ cd "$src_dir"
+ for f in `find . ! -type d ! -name '*.py' ! -name '*local_config_cuda*' ! -name '*local_config_tensorrt*' ! -name '*org_tensorflow*'`; do
+ mkdir -p "${dest_dir}/$(dirname ${f})"
+ cp "${f}" "${dest_dir}/$(dirname ${f})/"
done
+ popd
+
mkdir -p "${dest_dir}/local_config_cuda/cuda/cuda/"
cp "${src_dir}/local_config_cuda/cuda/cuda/cuda_config.h" "${dest_dir}/local_config_cuda/cuda/cuda/"
}
@@ -49,6 +55,8 @@ function prepare_src() {
TMPDIR="$1"
mkdir -p "$TMPDIR"
+ EXTERNAL_INCLUDES="${TMPDIR}/tensorflow/include/external"
+
echo $(date) : "=== Preparing sources in dir: ${TMPDIR}"
if [ ! -d bazel-bin/tensorflow ]; then
@@ -66,10 +74,9 @@ function prepare_src() {
cp -R \
bazel-bin/tensorflow/tools/pip_package/simple_console_for_window_unzip/runfiles/org_tensorflow/tensorflow \
"${TMPDIR}"
- mkdir "${TMPDIR}/external"
cp_external \
bazel-bin/tensorflow/tools/pip_package/simple_console_for_window_unzip/runfiles \
- "${TMPDIR}/external"
+ "${EXTERNAL_INCLUDES}/"
RUNFILES=bazel-bin/tensorflow/tools/pip_package/simple_console_for_window_unzip/runfiles/org_tensorflow
else
RUNFILES=bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow
@@ -78,10 +85,9 @@ function prepare_src() {
cp -R \
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/tensorflow \
"${TMPDIR}"
- mkdir "${TMPDIR}/external"
cp_external \
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/external \
- "${TMPDIR}/external"
+ "${EXTERNAL_INCLUDES}"
# Copy MKL libs over so they can be loaded at runtime
so_lib_dir=$(ls $RUNFILES | grep solib) || true
if [ -n "${so_lib_dir}" ]; then
@@ -96,10 +102,9 @@ function prepare_src() {
cp -R \
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/tensorflow \
"${TMPDIR}"
- mkdir "${TMPDIR}/external"
cp_external \
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles \
- "${TMPDIR}/external"
+ "${EXTERNAL_INCLUDES}"
# Copy MKL libs over so they can be loaded at runtime
so_lib_dir=$(ls $RUNFILES | grep solib) || true
if [ -n "${so_lib_dir}" ]; then
--
GitLab
From 1adbc5aa6927d1a5d7151c31aea1da6e73a1b53c Mon Sep 17 00:00:00 2001
From: Allen Lavoie
Date: Thu, 31 May 2018 19:03:21 -0700
Subject: [PATCH 038/519] Add a single positional argument mode for shape
inference in subclassed Models.
Allows fit() when call's signature looks something like call(x, training=True).
Calling conventions are "inputs", single positional, and multiple positional. Right now the distinction between "inputs" and single positional calling conventions is the text of one error message. Both support shape inference (which just hasn't been implemented for multiple positional input arguments yet).
PiperOrigin-RevId: 198815483
---
tensorflow/python/keras/engine/base_layer.py | 45 ++++++++++++++---
tensorflow/python/keras/engine/network.py | 50 ++++++++++++++++---
tensorflow/python/keras/engine/training.py | 27 ++++++----
.../python/keras/model_subclassing_test.py | 4 +-
4 files changed, 98 insertions(+), 28 deletions(-)
diff --git a/tensorflow/python/keras/engine/base_layer.py b/tensorflow/python/keras/engine/base_layer.py
index 24716cfbe4..4814275fd5 100644
--- a/tensorflow/python/keras/engine/base_layer.py
+++ b/tensorflow/python/keras/engine/base_layer.py
@@ -19,6 +19,7 @@ from __future__ import division
from __future__ import print_function
import collections
+import enum # pylint: disable=g-bad-import-order
import inspect # Necessary supplement to tf_inspect to deal with variadic args.
import numpy as np
@@ -50,6 +51,20 @@ from tensorflow.python.util import tf_inspect
from tensorflow.python.util.tf_export import tf_export
+class CallConvention(enum.Enum):
+ """Calling conventions for passing `Layer` inputs to `Layer.call`."""
+ # The Layer takes inputs as its first argument, named "inputs" for
+ # compatibility with the signature of Layer.__call__. This is the mode assumed
+ # for Layers which are not subclassed Models.
+ EXPLICIT_INPUTS_ARGUMENT = 1
+ # The Layer takes a single positional argument, not named "inputs". It's
+ # treated like an "inputs" argument.
+ SINGLE_POSITIONAL_ARGUMENT = 2
+ # The Layer has multiple positional arguments to which its inputs should be
+ # bound.
+ POSITIONAL_ARGUMENTS_ARE_INPUTS = 3
+
+
@tf_export('keras.layers.Layer')
class Layer(checkpointable.CheckpointableBase):
"""Base layer class.
@@ -149,7 +164,7 @@ class Layer(checkpointable.CheckpointableBase):
self._call_fn_args = function_utils.fn_args(self.call)
self._compute_previous_mask = ('mask' in self._call_fn_args or
hasattr(self, 'compute_mask'))
- self._uses_inputs_arg = True
+ self._call_convention = CallConvention.EXPLICIT_INPUTS_ARGUMENT
# These lists will be filled via successive calls
# to self._add_inbound_node().
@@ -793,12 +808,22 @@ class Layer(checkpointable.CheckpointableBase):
pass # C type such as dict. Masking not supported in this case.
def _set_connectivity_metadata_(self, inputs, outputs, args, kwargs):
- if args and getattr(self, '_uses_inputs_arg', True):
- raise TypeError(
- 'This Layer takes an `inputs` argument to call(), and only the '
- '`inputs` argument may be specified as a positional argument. '
- 'Pass everything else as a keyword argument (those arguments will'
- ' not be tracked as inputs to the Layer).')
+ call_convention = getattr(self, '_call_convention',
+ CallConvention.EXPLICIT_INPUTS_ARGUMENT)
+ if args:
+ if call_convention == CallConvention.EXPLICIT_INPUTS_ARGUMENT:
+ raise TypeError(
+ 'This Layer takes an `inputs` argument to call(), and only the '
+ '`inputs` argument may be specified as a positional argument. '
+ 'Pass everything else as a keyword argument (those arguments will'
+ ' not be tracked as inputs to the Layer).')
+ elif call_convention == CallConvention.SINGLE_POSITIONAL_ARGUMENT:
+ raise TypeError(
+ 'This Layer takes a single positional argument to call(), which is '
+ 'by convention the inputs argument, and only this argument may be '
+ 'specified as a positional argument. Pass everything else as a '
+ 'keyword argument (those arguments will not be tracked as inputs '
+ 'to the Layer).')
# If the layer returns tensors from its inputs, unmodified,
# we copy them to avoid loss of tensor metadata.
@@ -834,7 +859,11 @@ class Layer(checkpointable.CheckpointableBase):
A tuple of (inputs, non_input_kwargs). These may be the same objects as
were passed in (call_args and call_kwargs).
"""
- if getattr(self, '_uses_inputs_arg', True):
+ call_convention = getattr(self, '_call_convention',
+ CallConvention.EXPLICIT_INPUTS_ARGUMENT)
+ if (call_convention in (
+ CallConvention.EXPLICIT_INPUTS_ARGUMENT,
+ CallConvention.SINGLE_POSITIONAL_ARGUMENT)):
assert len(call_args) == 1 # TypeError raised earlier in __call__.
return call_args[0], call_kwargs
else:
diff --git a/tensorflow/python/keras/engine/network.py b/tensorflow/python/keras/engine/network.py
index 3d567b8378..6f27eea1e7 100644
--- a/tensorflow/python/keras/engine/network.py
+++ b/tensorflow/python/keras/engine/network.py
@@ -135,7 +135,7 @@ class Network(base_layer.Layer):
self._in_progress_restore_finalizer = None
def _init_graph_network(self, inputs, outputs, name=None):
- self._uses_inputs_arg = True
+ self._call_convention = base_layer.CallConvention.EXPLICIT_INPUTS_ARGUMENT
# Normalize and set self.inputs, self.outputs.
if isinstance(inputs, (list, tuple)):
self.inputs = list(inputs) # Tensor or list of tensors.
@@ -295,19 +295,55 @@ class Network(base_layer.Layer):
def _init_subclassed_network(self, name=None):
self._base_init(name=name)
self._is_graph_network = False
- call_args = tf_inspect.getargspec(self.call).args
- if 'training' in call_args:
+ call_argspec = tf_inspect.getargspec(self.call)
+ if 'training' in call_argspec.args:
self._expects_training_arg = True
else:
self._expects_training_arg = False
- if 'inputs' in call_args:
- self._uses_inputs_arg = True
- else:
- self._uses_inputs_arg = False
+ self._call_convention = self._determine_call_convention(call_argspec)
self.outputs = None
self.inputs = None
self.built = False
+ def _determine_call_convention(self, call_argspec):
+ """Decides how `self.call()` is invoked. See base_layer.CallConvention."""
+ if call_argspec.varargs:
+ may_take_single_argument = False
+ else:
+ try:
+ # Note: tf_inspect doesn't raise a TypeError when regular inspect would,
+ # so we need to keep in mind that "getcallargs" may have returned
+ # something even though we under-specified positional arguments.
+ all_args = tf_inspect.getcallargs(self.call, None)
+ self_args = set()
+ for arg_name, obj in all_args.items():
+ if obj is self:
+ self_args.add(arg_name)
+ may_take_single_argument = True
+ except TypeError:
+ may_take_single_argument = False
+ if may_take_single_argument:
+ # A single positional argument (plus "self") is considered equivalent to
+ # an "inputs" argument.
+ all_positional_args = len(call_argspec.args)
+ if call_argspec.defaults is not None:
+ all_positional_args -= len(call_argspec.defaults)
+ non_self_positional_args = all_positional_args
+ for positional_arg_name in call_argspec.args[:all_positional_args]:
+ if positional_arg_name in self_args:
+ non_self_positional_args -= 1
+ if non_self_positional_args == 1:
+ if 'inputs' in call_argspec.args[all_positional_args:]:
+ raise TypeError(
+ "Model.call() takes a single positional argument (to which "
+ "inputs are passed by convention) and a separate 'inputs' "
+ "argument. Unable to determine which arguments are inputs.")
+ return base_layer.CallConvention.SINGLE_POSITIONAL_ARGUMENT
+ if 'inputs' in call_argspec.args:
+ return base_layer.CallConvention.EXPLICIT_INPUTS_ARGUMENT
+ else:
+ return base_layer.CallConvention.POSITIONAL_ARGUMENTS_ARE_INPUTS
+
def _track_layers(self, layers):
"""Add Checkpointable dependencies on a list of Layers."""
weight_layer_index = 0
diff --git a/tensorflow/python/keras/engine/training.py b/tensorflow/python/keras/engine/training.py
index 6d625f16c2..04a2aa7664 100644
--- a/tensorflow/python/keras/engine/training.py
+++ b/tensorflow/python/keras/engine/training.py
@@ -31,12 +31,11 @@ from tensorflow.python.keras import backend as K
from tensorflow.python.keras import losses
from tensorflow.python.keras import metrics as metrics_module
from tensorflow.python.keras import optimizers
+from tensorflow.python.keras.engine import base_layer
from tensorflow.python.keras.engine import training_arrays
from tensorflow.python.keras.engine import training_eager
from tensorflow.python.keras.engine import training_generator
from tensorflow.python.keras.engine import training_utils
-from tensorflow.python.keras.engine.base_layer import DeferredTensor
-from tensorflow.python.keras.engine.base_layer import Layer
from tensorflow.python.keras.engine.network import Network
from tensorflow.python.keras.utils.generic_utils import slice_arrays
from tensorflow.python.ops import array_ops
@@ -523,7 +522,7 @@ class Model(Network):
# Keep track of state updates created by
# stateful metrics (i.e. metrics layers).
- if isinstance(metric_fn, Layer) and metric_fn.stateful:
+ if isinstance(metric_fn, base_layer.Layer) and metric_fn.stateful:
self.stateful_metric_names.append(metric_name)
self.stateful_metric_functions.append(metric_fn)
self.metrics_updates += metric_fn.updates
@@ -959,11 +958,17 @@ class Model(Network):
whether to build the model's graph in inference mode (False), training
mode (True), or using the Keras learning phase (None).
"""
- if not getattr(self, '_uses_inputs_arg', True):
+ call_convention = getattr(
+ self,
+ '_call_convention',
+ base_layer.CallConvention.EXPLICIT_INPUTS_ARGUMENT)
+ if call_convention not in (
+ base_layer.CallConvention.EXPLICIT_INPUTS_ARGUMENT,
+ base_layer.CallConvention.SINGLE_POSITIONAL_ARGUMENT):
raise NotImplementedError(
- 'Subclassed Models without "inputs" in their call() signatures do '
- 'not yet support shape inference. File a feature request if this '
- 'limitation bothers you.')
+ 'Subclassed Models without "inputs" (or single positional arguments) '
+ 'in their call() signatures do not yet support shape inference. File '
+ 'a feature request if this limitation bothers you.')
if self.__class__.__name__ == 'Sequential':
# Note: we can't test whether the model is `Sequential` via `isinstance`
# since `Sequential` depends on `Model`.
@@ -1020,11 +1025,11 @@ class Model(Network):
else:
dummy_output_values = [dummy_output_values]
self.outputs = [
- DeferredTensor(shape=(None for _ in v.shape),
- dtype=v.dtype) for v in dummy_output_values]
+ base_layer.DeferredTensor(shape=(None for _ in v.shape),
+ dtype=v.dtype) for v in dummy_output_values]
self.inputs = [
- DeferredTensor(shape=(None for _ in v.shape),
- dtype=v.dtype) for v in dummy_input_values]
+ base_layer.DeferredTensor(shape=(None for _ in v.shape),
+ dtype=v.dtype) for v in dummy_input_values]
self.input_names = [
'input_%d' % (i + 1) for i in range(len(dummy_input_values))]
self.output_names = [
diff --git a/tensorflow/python/keras/model_subclassing_test.py b/tensorflow/python/keras/model_subclassing_test.py
index 86f7e20bec..8fb957da43 100644
--- a/tensorflow/python/keras/model_subclassing_test.py
+++ b/tensorflow/python/keras/model_subclassing_test.py
@@ -56,8 +56,8 @@ class SimpleTestModel(keras.Model):
if self.use_bn:
self.bn = keras.layers.BatchNormalization(axis=-1)
- def call(self, inputs):
- x = self.dense1(inputs)
+ def call(self, x):
+ x = self.dense1(x)
if self.use_dp:
x = self.dp(x)
if self.use_bn:
--
GitLab
From 6fb75293ec2cb5cd8d815cf98ec33aa953442b34 Mon Sep 17 00:00:00 2001
From: Derek Murray
Date: Wed, 20 Jun 2018 10:10:55 -0700
Subject: [PATCH 039/519] [tf.data] Properly export
`tf.contrib.data.choose_from_datasets()`
PiperOrigin-RevId: 201371642
---
tensorflow/contrib/data/__init__.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/tensorflow/contrib/data/__init__.py b/tensorflow/contrib/data/__init__.py
index 1af1ed08b5..9c6a13333e 100644
--- a/tensorflow/contrib/data/__init__.py
+++ b/tensorflow/contrib/data/__init__.py
@@ -72,6 +72,7 @@ from tensorflow.contrib.data.python.ops.error_ops import ignore_errors
from tensorflow.contrib.data.python.ops.get_single_element import get_single_element
from tensorflow.contrib.data.python.ops.grouping import bucket_by_sequence_length
from tensorflow.contrib.data.python.ops.grouping import group_by_window
+from tensorflow.contrib.data.python.ops.interleave_ops import choose_from_datasets
from tensorflow.contrib.data.python.ops.interleave_ops import parallel_interleave
from tensorflow.contrib.data.python.ops.interleave_ops import sample_from_datasets
from tensorflow.contrib.data.python.ops.interleave_ops import sloppy_interleave
--
GitLab
From 579b598862b14b7a8e242cb1b094221f7e08b499 Mon Sep 17 00:00:00 2001
From: Yu Yi
Date: Fri, 22 Jun 2018 11:46:33 -0400
Subject: [PATCH 040/519] update the py/py3 toolchain config
- the python3 are installed in /opt/python3.6 in the base toolchain
container:
https://console.cloud.google.com/launcher/details/google/rbe-ubuntu16-04
---
third_party/toolchains/cpus/py/BUILD | 242 ++++++++++++--------------
third_party/toolchains/cpus/py3/BUILD | 234 +++++++++++++------------
2 files changed, 231 insertions(+), 245 deletions(-)
diff --git a/third_party/toolchains/cpus/py/BUILD b/third_party/toolchains/cpus/py/BUILD
index c175742cbf..10184e215b 100644
--- a/third_party/toolchains/cpus/py/BUILD
+++ b/third_party/toolchains/cpus/py/BUILD
@@ -6,20 +6,26 @@ licenses(["restricted"])
package(default_visibility = ["//visibility:public"])
+# To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib
+# See https://docs.python.org/3/extending/windows.html
+cc_import(
+ name = "python_lib",
+ interface_library = select({
+ ":windows": ":python_import_lib",
+ # A placeholder for Unix platforms which makes --no_build happy.
+ "//conditions:default": "not-existing.lib",
+ }),
+ system_provided = 1,
+)
+
cc_library(
name = "python_headers",
hdrs = [":python_include"],
- data = select({
- ":windows": [":python_import_lib"],
+ deps = select({
+ ":windows": [":python_lib"],
"//conditions:default": [],
}),
includes = ["python_include"],
- linkopts = select({
- # TODO(pcloudy): Ideally, this should just go into deps after resolving
- # https://github.com/bazelbuild/bazel/issues/3237,
- ":windows": ["$(locations :python_import_lib)"],
- "//conditions:default": [],
- }),
)
cc_library(
@@ -37,161 +43,135 @@ config_setting(
genrule(
name = "python_include",
outs = [
+ "python_include/Python-ast.h",
+ "python_include/Python.h",
+ "python_include/abstract.h",
+ "python_include/asdl.h",
+ "python_include/ast.h",
+ "python_include/bitset.h",
+ "python_include/boolobject.h",
+ "python_include/bufferobject.h",
+ "python_include/bytearrayobject.h",
+ "python_include/bytes_methods.h",
+ "python_include/bytesobject.h",
+ "python_include/cStringIO.h",
+ "python_include/cellobject.h",
+ "python_include/ceval.h",
+ "python_include/classobject.h",
+ "python_include/cobject.h",
"python_include/code.h",
+ "python_include/codecs.h",
+ "python_include/compile.h",
+ "python_include/complexobject.h",
+ "python_include/datetime.h",
+ "python_include/descrobject.h",
+ "python_include/dictobject.h",
"python_include/dtoa.h",
- "python_include/tupleobject.h",
- "python_include/object.h",
- "python_include/ast.h",
- "python_include/pymacconfig.h",
+ "python_include/enumobject.h",
"python_include/errcode.h",
+ "python_include/eval.h",
+ "python_include/fileobject.h",
+ "python_include/floatobject.h",
"python_include/frameobject.h",
- "python_include/pgenheaders.h",
- "python_include/cellobject.h",
+ "python_include/funcobject.h",
+ "python_include/genobject.h",
+ "python_include/graminit.h",
+ "python_include/grammar.h",
+ "python_include/import.h",
"python_include/intobject.h",
- "python_include/pythread.h",
- "python_include/cStringIO.h",
- "python_include/boolobject.h",
+ "python_include/intrcheck.h",
+ "python_include/iterobject.h",
+ "python_include/listobject.h",
+ "python_include/longintrepr.h",
+ "python_include/longobject.h",
+ "python_include/marshal.h",
+ "python_include/memoryobject.h",
+ "python_include/metagrammar.h",
+ "python_include/methodobject.h",
"python_include/modsupport.h",
- "python_include/import.h",
- "python_include/pymath.h",
+ "python_include/moduleobject.h",
"python_include/node.h",
- "python_include/funcobject.h",
- "python_include/eval.h",
- "python_include/longintrepr.h",
- "python_include/floatobject.h",
- "python_include/rangeobject.h",
- "python_include/pyfpe.h",
- "python_include/pystrcmp.h",
- "python_include/dictobject.h",
- "python_include/pyarena.h",
+ "python_include/object.h",
"python_include/objimpl.h",
- "python_include/bitset.h",
- "python_include/memoryobject.h",
- "python_include/bytearrayobject.h",
+ "python_include/opcode.h",
+ "python_include/osdefs.h",
+ "python_include/parsetok.h",
+ "python_include/patchlevel.h",
+ "python_include/pgen.h",
+ "python_include/pgenheaders.h",
+ "python_include/py_curses.h",
+ "python_include/pyarena.h",
+ "python_include/pycapsule.h",
+ "python_include/pyconfig.h",
+ "python_include/pyctype.h",
"python_include/pydebug.h",
"python_include/pyerrors.h",
- "python_include/weakrefobject.h",
- "python_include/grammar.h",
- "python_include/symtable.h",
- "python_include/longobject.h",
- "python_include/structmember.h",
- "python_include/enumobject.h",
- "python_include/classobject.h",
- "python_include/unicodeobject.h",
- "python_include/sliceobject.h",
- "python_include/pystrtod.h",
- "python_include/genobject.h",
- "python_include/pymactoolbox.h",
- "python_include/compile.h",
"python_include/pyexpat.h",
- "python_include/asdl.h",
- "python_include/codecs.h",
- "python_include/pyctype.h",
- "python_include/sysmodule.h",
- "python_include/methodobject.h",
- "python_include/graminit.h",
- "python_include/cobject.h",
- "python_include/intrcheck.h",
- "python_include/pyport.h",
- "python_include/warnings.h",
- "python_include/osdefs.h",
- "python_include/fileobject.h",
- "python_include/stringobject.h",
- "python_include/timefuncs.h",
- "python_include/traceback.h",
- "python_include/ceval.h",
- "python_include/bytes_methods.h",
- "python_include/pyconfig.h",
- "python_include/Python.h",
- "python_include/moduleobject.h",
- "python_include/pystate.h",
- "python_include/descrobject.h",
- "python_include/ucnhash.h",
+ "python_include/pyfpe.h",
"python_include/pygetopt.h",
+ "python_include/pymacconfig.h",
+ "python_include/pymactoolbox.h",
+ "python_include/pymath.h",
"python_include/pymem.h",
- "python_include/complexobject.h",
- "python_include/structseq.h",
- "python_include/datetime.h",
+ "python_include/pyport.h",
+ "python_include/pystate.h",
+ "python_include/pystrcmp.h",
+ "python_include/pystrtod.h",
"python_include/pythonrun.h",
- "python_include/numpy/oldnumeric.h",
- "python_include/numpy/npy_1_7_deprecated_api.h",
- "python_include/numpy/ufunc_api.txt",
- "python_include/numpy/multiarray_api.txt",
- "python_include/numpy/halffloat.h",
- "python_include/numpy/npy_common.h",
- "python_include/numpy/utils.h",
- "python_include/numpy/npy_interrupt.h",
- "python_include/numpy/npy_endian.h",
- "python_include/numpy/__ufunc_api.h",
- "python_include/numpy/_neighborhood_iterator_imp.h",
- "python_include/numpy/ufuncobject.h",
- "python_include/numpy/ndarraytypes.h",
- "python_include/numpy/npy_math.h",
- "python_include/numpy/noprefix.h",
- "python_include/numpy/npy_3kcompat.h",
- "python_include/numpy/arrayscalars.h",
- "python_include/numpy/npy_os.h",
- "python_include/numpy/ndarrayobject.h",
- "python_include/numpy/npy_no_deprecated_api.h",
- "python_include/numpy/arrayobject.h",
- "python_include/numpy/_numpyconfig.h",
- "python_include/numpy/__multiarray_api.h",
- "python_include/numpy/npy_cpu.h",
- "python_include/numpy/old_defines.h",
- "python_include/numpy/numpyconfig.h",
- "python_include/pycapsule.h",
+ "python_include/pythread.h",
+ "python_include/rangeobject.h",
"python_include/setobject.h",
- "python_include/listobject.h",
- "python_include/bytesobject.h",
- "python_include/pgen.h",
- "python_include/patchlevel.h",
- "python_include/opcode.h",
- "python_include/parsetok.h",
- "python_include/marshal.h",
+ "python_include/sliceobject.h",
+ "python_include/stringobject.h",
+ "python_include/structmember.h",
+ "python_include/structseq.h",
+ "python_include/symtable.h",
+ "python_include/sysmodule.h",
+ "python_include/timefuncs.h",
"python_include/token.h",
- "python_include/iterobject.h",
- "python_include/abstract.h",
- "python_include/py_curses.h",
- "python_include/metagrammar.h",
- "python_include/bufferobject.h",
- "python_include/Python-ast.h",
+ "python_include/traceback.h",
+ "python_include/tupleobject.h",
+ "python_include/ucnhash.h",
+ "python_include/unicodeobject.h",
+ "python_include/warnings.h",
+ "python_include/weakrefobject.h",
],
cmd = """
-cp "/usr/include/python2.7/code.h" "$(@D)/python_include/code.h" && cp "/usr/include/python2.7/dtoa.h" "$(@D)/python_include/dtoa.h" && cp "/usr/include/python2.7/tupleobject.h" "$(@D)/python_include/tupleobject.h" && cp "/usr/include/python2.7/object.h" "$(@D)/python_include/object.h" && cp "/usr/include/python2.7/ast.h" "$(@D)/python_include/ast.h" && cp "/usr/include/python2.7/pymacconfig.h" "$(@D)/python_include/pymacconfig.h" && cp "/usr/include/python2.7/errcode.h" "$(@D)/python_include/errcode.h" && cp "/usr/include/python2.7/frameobject.h" "$(@D)/python_include/frameobject.h" && cp "/usr/include/python2.7/pgenheaders.h" "$(@D)/python_include/pgenheaders.h" && cp "/usr/include/python2.7/cellobject.h" "$(@D)/python_include/cellobject.h" && cp "/usr/include/python2.7/intobject.h" "$(@D)/python_include/intobject.h" && cp "/usr/include/python2.7/pythread.h" "$(@D)/python_include/pythread.h" && cp "/usr/include/python2.7/cStringIO.h" "$(@D)/python_include/cStringIO.h" && cp "/usr/include/python2.7/boolobject.h" "$(@D)/python_include/boolobject.h" && cp "/usr/include/python2.7/modsupport.h" "$(@D)/python_include/modsupport.h" && cp "/usr/include/python2.7/import.h" "$(@D)/python_include/import.h" && cp "/usr/include/python2.7/pymath.h" "$(@D)/python_include/pymath.h" && cp "/usr/include/python2.7/node.h" "$(@D)/python_include/node.h" && cp "/usr/include/python2.7/funcobject.h" "$(@D)/python_include/funcobject.h" && cp "/usr/include/python2.7/eval.h" "$(@D)/python_include/eval.h" && cp "/usr/include/python2.7/longintrepr.h" "$(@D)/python_include/longintrepr.h" && cp "/usr/include/python2.7/floatobject.h" "$(@D)/python_include/floatobject.h" && cp "/usr/include/python2.7/rangeobject.h" "$(@D)/python_include/rangeobject.h" && cp "/usr/include/python2.7/pyfpe.h" "$(@D)/python_include/pyfpe.h" && cp "/usr/include/python2.7/pystrcmp.h" "$(@D)/python_include/pystrcmp.h" && cp "/usr/include/python2.7/dictobject.h" "$(@D)/python_include/dictobject.h" && cp "/usr/include/python2.7/pyarena.h" "$(@D)/python_include/pyarena.h" && cp "/usr/include/python2.7/objimpl.h" "$(@D)/python_include/objimpl.h" && cp "/usr/include/python2.7/bitset.h" "$(@D)/python_include/bitset.h" && cp "/usr/include/python2.7/memoryobject.h" "$(@D)/python_include/memoryobject.h" && cp "/usr/include/python2.7/bytearrayobject.h" "$(@D)/python_include/bytearrayobject.h" && cp "/usr/include/python2.7/pydebug.h" "$(@D)/python_include/pydebug.h" && cp "/usr/include/python2.7/pyerrors.h" "$(@D)/python_include/pyerrors.h" && cp "/usr/include/python2.7/weakrefobject.h" "$(@D)/python_include/weakrefobject.h" && cp "/usr/include/python2.7/grammar.h" "$(@D)/python_include/grammar.h" && cp "/usr/include/python2.7/symtable.h" "$(@D)/python_include/symtable.h" && cp "/usr/include/python2.7/longobject.h" "$(@D)/python_include/longobject.h" && cp "/usr/include/python2.7/structmember.h" "$(@D)/python_include/structmember.h" && cp "/usr/include/python2.7/enumobject.h" "$(@D)/python_include/enumobject.h" && cp "/usr/include/python2.7/classobject.h" "$(@D)/python_include/classobject.h" && cp "/usr/include/python2.7/unicodeobject.h" "$(@D)/python_include/unicodeobject.h" && cp "/usr/include/python2.7/sliceobject.h" "$(@D)/python_include/sliceobject.h" && cp "/usr/include/python2.7/pystrtod.h" "$(@D)/python_include/pystrtod.h" && cp "/usr/include/python2.7/genobject.h" "$(@D)/python_include/genobject.h" && cp "/usr/include/python2.7/pymactoolbox.h" "$(@D)/python_include/pymactoolbox.h" && cp "/usr/include/python2.7/compile.h" "$(@D)/python_include/compile.h" && cp "/usr/include/python2.7/pyexpat.h" "$(@D)/python_include/pyexpat.h" && cp "/usr/include/python2.7/asdl.h" "$(@D)/python_include/asdl.h" && cp "/usr/include/python2.7/codecs.h" "$(@D)/python_include/codecs.h" && cp "/usr/include/python2.7/pyctype.h" "$(@D)/python_include/pyctype.h" && cp "/usr/include/python2.7/sysmodule.h" "$(@D)/python_include/sysmodule.h" && cp "/usr/include/python2.7/methodobject.h" "$(@D)/python_include/methodobject.h" && cp "/usr/include/python2.7/graminit.h" "$(@D)/python_include/graminit.h" && cp "/usr/include/python2.7/cobject.h" "$(@D)/python_include/cobject.h" && cp "/usr/include/python2.7/intrcheck.h" "$(@D)/python_include/intrcheck.h" && cp "/usr/include/python2.7/pyport.h" "$(@D)/python_include/pyport.h" && cp "/usr/include/python2.7/warnings.h" "$(@D)/python_include/warnings.h" && cp "/usr/include/python2.7/osdefs.h" "$(@D)/python_include/osdefs.h" && cp "/usr/include/python2.7/fileobject.h" "$(@D)/python_include/fileobject.h" && cp "/usr/include/python2.7/stringobject.h" "$(@D)/python_include/stringobject.h" && cp "/usr/include/python2.7/timefuncs.h" "$(@D)/python_include/timefuncs.h" && cp "/usr/include/python2.7/traceback.h" "$(@D)/python_include/traceback.h" && cp "/usr/include/python2.7/ceval.h" "$(@D)/python_include/ceval.h" && cp "/usr/include/python2.7/bytes_methods.h" "$(@D)/python_include/bytes_methods.h" && cp "/usr/include/python2.7/pyconfig.h" "$(@D)/python_include/pyconfig.h" && cp "/usr/include/python2.7/Python.h" "$(@D)/python_include/Python.h" && cp "/usr/include/python2.7/moduleobject.h" "$(@D)/python_include/moduleobject.h" && cp "/usr/include/python2.7/pystate.h" "$(@D)/python_include/pystate.h" && cp "/usr/include/python2.7/descrobject.h" "$(@D)/python_include/descrobject.h" && cp "/usr/include/python2.7/ucnhash.h" "$(@D)/python_include/ucnhash.h" && cp "/usr/include/python2.7/pygetopt.h" "$(@D)/python_include/pygetopt.h" && cp "/usr/include/python2.7/pymem.h" "$(@D)/python_include/pymem.h" && cp "/usr/include/python2.7/complexobject.h" "$(@D)/python_include/complexobject.h" && cp "/usr/include/python2.7/structseq.h" "$(@D)/python_include/structseq.h" && cp "/usr/include/python2.7/datetime.h" "$(@D)/python_include/datetime.h" && cp "/usr/include/python2.7/pythonrun.h" "$(@D)/python_include/pythonrun.h" && cp "/usr/include/python2.7/numpy/oldnumeric.h" "$(@D)/python_include/numpy/oldnumeric.h" && cp "/usr/include/python2.7/numpy/npy_1_7_deprecated_api.h" "$(@D)/python_include/numpy/npy_1_7_deprecated_api.h" && cp "/usr/include/python2.7/numpy/ufunc_api.txt" "$(@D)/python_include/numpy/ufunc_api.txt" && cp "/usr/include/python2.7/numpy/multiarray_api.txt" "$(@D)/python_include/numpy/multiarray_api.txt" && cp "/usr/include/python2.7/numpy/halffloat.h" "$(@D)/python_include/numpy/halffloat.h" && cp "/usr/include/python2.7/numpy/npy_common.h" "$(@D)/python_include/numpy/npy_common.h" && cp "/usr/include/python2.7/numpy/utils.h" "$(@D)/python_include/numpy/utils.h" && cp "/usr/include/python2.7/numpy/npy_interrupt.h" "$(@D)/python_include/numpy/npy_interrupt.h" && cp "/usr/include/python2.7/numpy/npy_endian.h" "$(@D)/python_include/numpy/npy_endian.h" && cp "/usr/include/python2.7/numpy/__ufunc_api.h" "$(@D)/python_include/numpy/__ufunc_api.h" && cp "/usr/include/python2.7/numpy/_neighborhood_iterator_imp.h" "$(@D)/python_include/numpy/_neighborhood_iterator_imp.h" && cp "/usr/include/python2.7/numpy/ufuncobject.h" "$(@D)/python_include/numpy/ufuncobject.h" && cp "/usr/include/python2.7/numpy/ndarraytypes.h" "$(@D)/python_include/numpy/ndarraytypes.h" && cp "/usr/include/python2.7/numpy/npy_math.h" "$(@D)/python_include/numpy/npy_math.h" && cp "/usr/include/python2.7/numpy/noprefix.h" "$(@D)/python_include/numpy/noprefix.h" && cp "/usr/include/python2.7/numpy/npy_3kcompat.h" "$(@D)/python_include/numpy/npy_3kcompat.h" && cp "/usr/include/python2.7/numpy/arrayscalars.h" "$(@D)/python_include/numpy/arrayscalars.h" && cp "/usr/include/python2.7/numpy/npy_os.h" "$(@D)/python_include/numpy/npy_os.h" && cp "/usr/include/python2.7/numpy/ndarrayobject.h" "$(@D)/python_include/numpy/ndarrayobject.h" && cp "/usr/include/python2.7/numpy/npy_no_deprecated_api.h" "$(@D)/python_include/numpy/npy_no_deprecated_api.h" && cp "/usr/include/python2.7/numpy/arrayobject.h" "$(@D)/python_include/numpy/arrayobject.h" && cp "/usr/include/python2.7/numpy/_numpyconfig.h" "$(@D)/python_include/numpy/_numpyconfig.h" && cp "/usr/include/python2.7/numpy/__multiarray_api.h" "$(@D)/python_include/numpy/__multiarray_api.h" && cp "/usr/include/python2.7/numpy/npy_cpu.h" "$(@D)/python_include/numpy/npy_cpu.h" && cp "/usr/include/python2.7/numpy/old_defines.h" "$(@D)/python_include/numpy/old_defines.h" && cp "/usr/include/python2.7/numpy/numpyconfig.h" "$(@D)/python_include/numpy/numpyconfig.h" && cp "/usr/include/python2.7/pycapsule.h" "$(@D)/python_include/pycapsule.h" && cp "/usr/include/python2.7/setobject.h" "$(@D)/python_include/setobject.h" && cp "/usr/include/python2.7/listobject.h" "$(@D)/python_include/listobject.h" && cp "/usr/include/python2.7/bytesobject.h" "$(@D)/python_include/bytesobject.h" && cp "/usr/include/python2.7/pgen.h" "$(@D)/python_include/pgen.h" && cp "/usr/include/python2.7/patchlevel.h" "$(@D)/python_include/patchlevel.h" && cp "/usr/include/python2.7/opcode.h" "$(@D)/python_include/opcode.h" && cp "/usr/include/python2.7/parsetok.h" "$(@D)/python_include/parsetok.h" && cp "/usr/include/python2.7/marshal.h" "$(@D)/python_include/marshal.h" && cp "/usr/include/python2.7/token.h" "$(@D)/python_include/token.h" && cp "/usr/include/python2.7/iterobject.h" "$(@D)/python_include/iterobject.h" && cp "/usr/include/python2.7/abstract.h" "$(@D)/python_include/abstract.h" && cp "/usr/include/python2.7/py_curses.h" "$(@D)/python_include/py_curses.h" && cp "/usr/include/python2.7/metagrammar.h" "$(@D)/python_include/metagrammar.h" && cp "/usr/include/python2.7/bufferobject.h" "$(@D)/python_include/bufferobject.h" && cp "/usr/include/python2.7/Python-ast.h" "$(@D)/python_include/Python-ast.h"
+cp "/usr/include/python2.7/Python-ast.h" "$(@D)/python_include/Python-ast.h" && cp "/usr/include/python2.7/Python.h" "$(@D)/python_include/Python.h" && cp "/usr/include/python2.7/abstract.h" "$(@D)/python_include/abstract.h" && cp "/usr/include/python2.7/asdl.h" "$(@D)/python_include/asdl.h" && cp "/usr/include/python2.7/ast.h" "$(@D)/python_include/ast.h" && cp "/usr/include/python2.7/bitset.h" "$(@D)/python_include/bitset.h" && cp "/usr/include/python2.7/boolobject.h" "$(@D)/python_include/boolobject.h" && cp "/usr/include/python2.7/bufferobject.h" "$(@D)/python_include/bufferobject.h" && cp "/usr/include/python2.7/bytearrayobject.h" "$(@D)/python_include/bytearrayobject.h" && cp "/usr/include/python2.7/bytes_methods.h" "$(@D)/python_include/bytes_methods.h" && cp "/usr/include/python2.7/bytesobject.h" "$(@D)/python_include/bytesobject.h" && cp "/usr/include/python2.7/cStringIO.h" "$(@D)/python_include/cStringIO.h" && cp "/usr/include/python2.7/cellobject.h" "$(@D)/python_include/cellobject.h" && cp "/usr/include/python2.7/ceval.h" "$(@D)/python_include/ceval.h" && cp "/usr/include/python2.7/classobject.h" "$(@D)/python_include/classobject.h" && cp "/usr/include/python2.7/cobject.h" "$(@D)/python_include/cobject.h" && cp "/usr/include/python2.7/code.h" "$(@D)/python_include/code.h" && cp "/usr/include/python2.7/codecs.h" "$(@D)/python_include/codecs.h" && cp "/usr/include/python2.7/compile.h" "$(@D)/python_include/compile.h" && cp "/usr/include/python2.7/complexobject.h" "$(@D)/python_include/complexobject.h" && cp "/usr/include/python2.7/datetime.h" "$(@D)/python_include/datetime.h" && cp "/usr/include/python2.7/descrobject.h" "$(@D)/python_include/descrobject.h" && cp "/usr/include/python2.7/dictobject.h" "$(@D)/python_include/dictobject.h" && cp "/usr/include/python2.7/dtoa.h" "$(@D)/python_include/dtoa.h" && cp "/usr/include/python2.7/enumobject.h" "$(@D)/python_include/enumobject.h" && cp "/usr/include/python2.7/errcode.h" "$(@D)/python_include/errcode.h" && cp "/usr/include/python2.7/eval.h" "$(@D)/python_include/eval.h" && cp "/usr/include/python2.7/fileobject.h" "$(@D)/python_include/fileobject.h" && cp "/usr/include/python2.7/floatobject.h" "$(@D)/python_include/floatobject.h" && cp "/usr/include/python2.7/frameobject.h" "$(@D)/python_include/frameobject.h" && cp "/usr/include/python2.7/funcobject.h" "$(@D)/python_include/funcobject.h" && cp "/usr/include/python2.7/genobject.h" "$(@D)/python_include/genobject.h" && cp "/usr/include/python2.7/graminit.h" "$(@D)/python_include/graminit.h" && cp "/usr/include/python2.7/grammar.h" "$(@D)/python_include/grammar.h" && cp "/usr/include/python2.7/import.h" "$(@D)/python_include/import.h" && cp "/usr/include/python2.7/intobject.h" "$(@D)/python_include/intobject.h" && cp "/usr/include/python2.7/intrcheck.h" "$(@D)/python_include/intrcheck.h" && cp "/usr/include/python2.7/iterobject.h" "$(@D)/python_include/iterobject.h" && cp "/usr/include/python2.7/listobject.h" "$(@D)/python_include/listobject.h" && cp "/usr/include/python2.7/longintrepr.h" "$(@D)/python_include/longintrepr.h" && cp "/usr/include/python2.7/longobject.h" "$(@D)/python_include/longobject.h" && cp "/usr/include/python2.7/marshal.h" "$(@D)/python_include/marshal.h" && cp "/usr/include/python2.7/memoryobject.h" "$(@D)/python_include/memoryobject.h" && cp "/usr/include/python2.7/metagrammar.h" "$(@D)/python_include/metagrammar.h" && cp "/usr/include/python2.7/methodobject.h" "$(@D)/python_include/methodobject.h" && cp "/usr/include/python2.7/modsupport.h" "$(@D)/python_include/modsupport.h" && cp "/usr/include/python2.7/moduleobject.h" "$(@D)/python_include/moduleobject.h" && cp "/usr/include/python2.7/node.h" "$(@D)/python_include/node.h" && cp "/usr/include/python2.7/object.h" "$(@D)/python_include/object.h" && cp "/usr/include/python2.7/objimpl.h" "$(@D)/python_include/objimpl.h" && cp "/usr/include/python2.7/opcode.h" "$(@D)/python_include/opcode.h" && cp "/usr/include/python2.7/osdefs.h" "$(@D)/python_include/osdefs.h" && cp "/usr/include/python2.7/parsetok.h" "$(@D)/python_include/parsetok.h" && cp "/usr/include/python2.7/patchlevel.h" "$(@D)/python_include/patchlevel.h" && cp "/usr/include/python2.7/pgen.h" "$(@D)/python_include/pgen.h" && cp "/usr/include/python2.7/pgenheaders.h" "$(@D)/python_include/pgenheaders.h" && cp "/usr/include/python2.7/py_curses.h" "$(@D)/python_include/py_curses.h" && cp "/usr/include/python2.7/pyarena.h" "$(@D)/python_include/pyarena.h" && cp "/usr/include/python2.7/pycapsule.h" "$(@D)/python_include/pycapsule.h" && cp "/usr/include/python2.7/pyconfig.h" "$(@D)/python_include/pyconfig.h" && cp "/usr/include/python2.7/pyctype.h" "$(@D)/python_include/pyctype.h" && cp "/usr/include/python2.7/pydebug.h" "$(@D)/python_include/pydebug.h" && cp "/usr/include/python2.7/pyerrors.h" "$(@D)/python_include/pyerrors.h" && cp "/usr/include/python2.7/pyexpat.h" "$(@D)/python_include/pyexpat.h" && cp "/usr/include/python2.7/pyfpe.h" "$(@D)/python_include/pyfpe.h" && cp "/usr/include/python2.7/pygetopt.h" "$(@D)/python_include/pygetopt.h" && cp "/usr/include/python2.7/pymacconfig.h" "$(@D)/python_include/pymacconfig.h" && cp "/usr/include/python2.7/pymactoolbox.h" "$(@D)/python_include/pymactoolbox.h" && cp "/usr/include/python2.7/pymath.h" "$(@D)/python_include/pymath.h" && cp "/usr/include/python2.7/pymem.h" "$(@D)/python_include/pymem.h" && cp "/usr/include/python2.7/pyport.h" "$(@D)/python_include/pyport.h" && cp "/usr/include/python2.7/pystate.h" "$(@D)/python_include/pystate.h" && cp "/usr/include/python2.7/pystrcmp.h" "$(@D)/python_include/pystrcmp.h" && cp "/usr/include/python2.7/pystrtod.h" "$(@D)/python_include/pystrtod.h" && cp "/usr/include/python2.7/pythonrun.h" "$(@D)/python_include/pythonrun.h" && cp "/usr/include/python2.7/pythread.h" "$(@D)/python_include/pythread.h" && cp "/usr/include/python2.7/rangeobject.h" "$(@D)/python_include/rangeobject.h" && cp "/usr/include/python2.7/setobject.h" "$(@D)/python_include/setobject.h" && cp "/usr/include/python2.7/sliceobject.h" "$(@D)/python_include/sliceobject.h" && cp "/usr/include/python2.7/stringobject.h" "$(@D)/python_include/stringobject.h" && cp "/usr/include/python2.7/structmember.h" "$(@D)/python_include/structmember.h" && cp "/usr/include/python2.7/structseq.h" "$(@D)/python_include/structseq.h" && cp "/usr/include/python2.7/symtable.h" "$(@D)/python_include/symtable.h" && cp "/usr/include/python2.7/sysmodule.h" "$(@D)/python_include/sysmodule.h" && cp "/usr/include/python2.7/timefuncs.h" "$(@D)/python_include/timefuncs.h" && cp "/usr/include/python2.7/token.h" "$(@D)/python_include/token.h" && cp "/usr/include/python2.7/traceback.h" "$(@D)/python_include/traceback.h" && cp "/usr/include/python2.7/tupleobject.h" "$(@D)/python_include/tupleobject.h" && cp "/usr/include/python2.7/ucnhash.h" "$(@D)/python_include/ucnhash.h" && cp "/usr/include/python2.7/unicodeobject.h" "$(@D)/python_include/unicodeobject.h" && cp "/usr/include/python2.7/warnings.h" "$(@D)/python_include/warnings.h" && cp "/usr/include/python2.7/weakrefobject.h" "$(@D)/python_include/weakrefobject.h"
""",
)
genrule(
name = "numpy_include",
outs = [
- "numpy_include/numpy/oldnumeric.h",
- "numpy_include/numpy/npy_1_7_deprecated_api.h",
- "numpy_include/numpy/ufunc_api.txt",
- "numpy_include/numpy/multiarray_api.txt",
- "numpy_include/numpy/halffloat.h",
- "numpy_include/numpy/npy_common.h",
- "numpy_include/numpy/utils.h",
- "numpy_include/numpy/npy_interrupt.h",
- "numpy_include/numpy/npy_endian.h",
+ "numpy_include/numpy/__multiarray_api.h",
"numpy_include/numpy/__ufunc_api.h",
"numpy_include/numpy/_neighborhood_iterator_imp.h",
- "numpy_include/numpy/ufuncobject.h",
+ "numpy_include/numpy/_numpyconfig.h",
+ "numpy_include/numpy/arrayobject.h",
+ "numpy_include/numpy/arrayscalars.h",
+ "numpy_include/numpy/halffloat.h",
+ "numpy_include/numpy/multiarray_api.txt",
+ "numpy_include/numpy/ndarrayobject.h",
"numpy_include/numpy/ndarraytypes.h",
- "numpy_include/numpy/npy_math.h",
"numpy_include/numpy/noprefix.h",
+ "numpy_include/numpy/npy_1_7_deprecated_api.h",
"numpy_include/numpy/npy_3kcompat.h",
- "numpy_include/numpy/arrayscalars.h",
- "numpy_include/numpy/npy_os.h",
- "numpy_include/numpy/ndarrayobject.h",
- "numpy_include/numpy/npy_no_deprecated_api.h",
- "numpy_include/numpy/arrayobject.h",
- "numpy_include/numpy/_numpyconfig.h",
- "numpy_include/numpy/__multiarray_api.h",
+ "numpy_include/numpy/npy_common.h",
"numpy_include/numpy/npy_cpu.h",
- "numpy_include/numpy/old_defines.h",
+ "numpy_include/numpy/npy_endian.h",
+ "numpy_include/numpy/npy_interrupt.h",
+ "numpy_include/numpy/npy_math.h",
+ "numpy_include/numpy/npy_no_deprecated_api.h",
+ "numpy_include/numpy/npy_os.h",
"numpy_include/numpy/numpyconfig.h",
+ "numpy_include/numpy/old_defines.h",
+ "numpy_include/numpy/oldnumeric.h",
+ "numpy_include/numpy/ufunc_api.txt",
+ "numpy_include/numpy/ufuncobject.h",
+ "numpy_include/numpy/utils.h",
],
cmd = """
-cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/oldnumeric.h" "$(@D)/numpy_include/numpy/oldnumeric.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_1_7_deprecated_api.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufunc_api.txt" "$(@D)/numpy_include/numpy/ufunc_api.txt" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/multiarray_api.txt" "$(@D)/numpy_include/numpy/multiarray_api.txt" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/halffloat.h" "$(@D)/numpy_include/numpy/halffloat.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_common.h" "$(@D)/numpy_include/numpy/npy_common.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/utils.h" "$(@D)/numpy_include/numpy/utils.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_interrupt.h" "$(@D)/numpy_include/numpy/npy_interrupt.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_endian.h" "$(@D)/numpy_include/numpy/npy_endian.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h" "$(@D)/numpy_include/numpy/__ufunc_api.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/_neighborhood_iterator_imp.h" "$(@D)/numpy_include/numpy/_neighborhood_iterator_imp.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h" "$(@D)/numpy_include/numpy/ufuncobject.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h" "$(@D)/numpy_include/numpy/ndarraytypes.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_math.h" "$(@D)/numpy_include/numpy/npy_math.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/noprefix.h" "$(@D)/numpy_include/numpy/noprefix.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_3kcompat.h" "$(@D)/numpy_include/numpy/npy_3kcompat.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayscalars.h" "$(@D)/numpy_include/numpy/arrayscalars.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_os.h" "$(@D)/numpy_include/numpy/npy_os.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h" "$(@D)/numpy_include/numpy/ndarrayobject.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_no_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_no_deprecated_api.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h" "$(@D)/numpy_include/numpy/arrayobject.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/_numpyconfig.h" "$(@D)/numpy_include/numpy/_numpyconfig.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h" "$(@D)/numpy_include/numpy/__multiarray_api.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_cpu.h" "$(@D)/numpy_include/numpy/npy_cpu.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/old_defines.h" "$(@D)/numpy_include/numpy/old_defines.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/numpyconfig.h" "$(@D)/numpy_include/numpy/numpyconfig.h"
+cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h" "$(@D)/numpy_include/numpy/__multiarray_api.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h" "$(@D)/numpy_include/numpy/__ufunc_api.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/_neighborhood_iterator_imp.h" "$(@D)/numpy_include/numpy/_neighborhood_iterator_imp.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/_numpyconfig.h" "$(@D)/numpy_include/numpy/_numpyconfig.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h" "$(@D)/numpy_include/numpy/arrayobject.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayscalars.h" "$(@D)/numpy_include/numpy/arrayscalars.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/halffloat.h" "$(@D)/numpy_include/numpy/halffloat.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/multiarray_api.txt" "$(@D)/numpy_include/numpy/multiarray_api.txt" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h" "$(@D)/numpy_include/numpy/ndarrayobject.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h" "$(@D)/numpy_include/numpy/ndarraytypes.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/noprefix.h" "$(@D)/numpy_include/numpy/noprefix.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_1_7_deprecated_api.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_3kcompat.h" "$(@D)/numpy_include/numpy/npy_3kcompat.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_common.h" "$(@D)/numpy_include/numpy/npy_common.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_cpu.h" "$(@D)/numpy_include/numpy/npy_cpu.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_endian.h" "$(@D)/numpy_include/numpy/npy_endian.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_interrupt.h" "$(@D)/numpy_include/numpy/npy_interrupt.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_math.h" "$(@D)/numpy_include/numpy/npy_math.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_no_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_no_deprecated_api.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_os.h" "$(@D)/numpy_include/numpy/npy_os.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/numpyconfig.h" "$(@D)/numpy_include/numpy/numpyconfig.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/old_defines.h" "$(@D)/numpy_include/numpy/old_defines.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/oldnumeric.h" "$(@D)/numpy_include/numpy/oldnumeric.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ufunc_api.txt" "$(@D)/numpy_include/numpy/ufunc_api.txt" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h" "$(@D)/numpy_include/numpy/ufuncobject.h" && cp "/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/utils.h" "$(@D)/numpy_include/numpy/utils.h"
""",
)
diff --git a/third_party/toolchains/cpus/py3/BUILD b/third_party/toolchains/cpus/py3/BUILD
index 932a25239f..28712a7cb1 100644
--- a/third_party/toolchains/cpus/py3/BUILD
+++ b/third_party/toolchains/cpus/py3/BUILD
@@ -6,20 +6,26 @@ licenses(["restricted"])
package(default_visibility = ["//visibility:public"])
+# To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib
+# See https://docs.python.org/3/extending/windows.html
+cc_import(
+ name = "python_lib",
+ interface_library = select({
+ ":windows": ":python_import_lib",
+ # A placeholder for Unix platforms which makes --no_build happy.
+ "//conditions:default": "not-existing.lib",
+ }),
+ system_provided = 1,
+)
+
cc_library(
name = "python_headers",
hdrs = [":python_include"],
- data = select({
- ":windows": [":python_import_lib"],
+ deps = select({
+ ":windows": [":python_lib"],
"//conditions:default": [],
}),
includes = ["python_include"],
- linkopts = select({
- # TODO(pcloudy): Ideally, this should just go into deps after resolving
- # https://github.com/bazelbuild/bazel/issues/3237,
- ":windows": ["$(locations :python_import_lib)"],
- "//conditions:default": [],
- }),
)
cc_library(
@@ -37,143 +43,143 @@ config_setting(
genrule(
name = "python_include",
outs = [
- "python_include/code.h",
- "python_include/dtoa.h",
- "python_include/tupleobject.h",
- "python_include/object.h",
- "python_include/ast.h",
- "python_include/pymacconfig.h",
- "python_include/errcode.h",
- "python_include/frameobject.h",
- "python_include/typeslots.h",
- "python_include/pgenheaders.h",
- "python_include/cellobject.h",
- "python_include/pythread.h",
- "python_include/boolobject.h",
+ "python_include/Python-ast.h",
+ "python_include/Python.h",
+ "python_include/abstract.h",
"python_include/accu.h",
- "python_include/modsupport.h",
- "python_include/import.h",
- "python_include/pymath.h",
- "python_include/node.h",
- "python_include/funcobject.h",
- "python_include/eval.h",
- "python_include/pyatomic.h",
- "python_include/longintrepr.h",
- "python_include/floatobject.h",
- "python_include/rangeobject.h",
- "python_include/pyfpe.h",
- "python_include/pystrcmp.h",
- "python_include/fileutils.h",
- "python_include/dictobject.h",
- "python_include/pyarena.h",
- "python_include/osmodule.h",
- "python_include/objimpl.h",
+ "python_include/asdl.h",
+ "python_include/ast.h",
"python_include/bitset.h",
- "python_include/memoryobject.h",
+ "python_include/bltinmodule.h",
+ "python_include/boolobject.h",
"python_include/bytearrayobject.h",
- "python_include/pydebug.h",
- "python_include/pyerrors.h",
- "python_include/weakrefobject.h",
- "python_include/grammar.h",
- "python_include/symtable.h",
- "python_include/longobject.h",
- "python_include/structmember.h",
- "python_include/enumobject.h",
- "python_include/pymacro.h",
+ "python_include/bytes_methods.h",
+ "python_include/bytesobject.h",
+ "python_include/cellobject.h",
+ "python_include/ceval.h",
"python_include/classobject.h",
- "python_include/unicodeobject.h",
- "python_include/sliceobject.h",
- "python_include/pystrtod.h",
- "python_include/genobject.h",
- "python_include/compile.h",
- "python_include/pyexpat.h",
- "python_include/asdl.h",
+ "python_include/code.h",
"python_include/codecs.h",
+ "python_include/compile.h",
+ "python_include/complexobject.h",
+ "python_include/datetime.h",
+ "python_include/descrobject.h",
+ "python_include/dictobject.h",
+ "python_include/dtoa.h",
"python_include/dynamic_annotations.h",
- "python_include/pyctype.h",
- "python_include/sysmodule.h",
- "python_include/methodobject.h",
+ "python_include/enumobject.h",
+ "python_include/errcode.h",
+ "python_include/eval.h",
+ "python_include/fileobject.h",
+ "python_include/fileutils.h",
+ "python_include/floatobject.h",
+ "python_include/frameobject.h",
+ "python_include/funcobject.h",
+ "python_include/genobject.h",
"python_include/graminit.h",
- "python_include/bltinmodule.h",
+ "python_include/grammar.h",
+ "python_include/import.h",
"python_include/intrcheck.h",
- "python_include/pyport.h",
- "python_include/warnings.h",
- "python_include/osdefs.h",
- "python_include/pydtrace.h",
- "python_include/pylifecycle.h",
- "python_include/fileobject.h",
- "python_include/pytime.h",
- "python_include/traceback.h",
- "python_include/ceval.h",
- "python_include/bytes_methods.h",
- "python_include/namespaceobject.h",
- "python_include/pyconfig.h",
- "python_include/Python.h",
+ "python_include/iterobject.h",
+ "python_include/listobject.h",
+ "python_include/longintrepr.h",
+ "python_include/longobject.h",
+ "python_include/marshal.h",
+ "python_include/memoryobject.h",
+ "python_include/metagrammar.h",
+ "python_include/methodobject.h",
+ "python_include/modsupport.h",
"python_include/moduleobject.h",
- "python_include/pystate.h",
- "python_include/descrobject.h",
+ "python_include/namespaceobject.h",
+ "python_include/node.h",
+ "python_include/object.h",
+ "python_include/objimpl.h",
"python_include/odictobject.h",
- "python_include/ucnhash.h",
+ "python_include/opcode.h",
+ "python_include/osdefs.h",
+ "python_include/osmodule.h",
+ "python_include/parsetok.h",
+ "python_include/patchlevel.h",
+ "python_include/pgen.h",
+ "python_include/pgenheaders.h",
+ "python_include/py_curses.h",
+ "python_include/pyarena.h",
+ "python_include/pyatomic.h",
+ "python_include/pycapsule.h",
+ "python_include/pyconfig.h",
+ "python_include/pyctype.h",
+ "python_include/pydebug.h",
+ "python_include/pydtrace.h",
+ "python_include/pyerrors.h",
+ "python_include/pyexpat.h",
+ "python_include/pyfpe.h",
"python_include/pygetopt.h",
+ "python_include/pyhash.h",
+ "python_include/pylifecycle.h",
+ "python_include/pymacconfig.h",
+ "python_include/pymacro.h",
+ "python_include/pymath.h",
"python_include/pymem.h",
- "python_include/complexobject.h",
- "python_include/structseq.h",
- "python_include/datetime.h",
+ "python_include/pyport.h",
+ "python_include/pystate.h",
+ "python_include/pystrcmp.h",
+ "python_include/pystrhex.h",
+ "python_include/pystrtod.h",
"python_include/pythonrun.h",
- "python_include/pyhash.h",
- "python_include/pycapsule.h",
+ "python_include/pythread.h",
+ "python_include/pytime.h",
+ "python_include/rangeobject.h",
"python_include/setobject.h",
- "python_include/listobject.h",
- "python_include/bytesobject.h",
- "python_include/pgen.h",
- "python_include/patchlevel.h",
- "python_include/opcode.h",
- "python_include/parsetok.h",
- "python_include/pystrhex.h",
- "python_include/marshal.h",
+ "python_include/sliceobject.h",
+ "python_include/structmember.h",
+ "python_include/structseq.h",
+ "python_include/symtable.h",
+ "python_include/sysmodule.h",
"python_include/token.h",
- "python_include/iterobject.h",
- "python_include/abstract.h",
- "python_include/py_curses.h",
- "python_include/metagrammar.h",
- "python_include/Python-ast.h",
+ "python_include/traceback.h",
+ "python_include/tupleobject.h",
+ "python_include/typeslots.h",
+ "python_include/ucnhash.h",
+ "python_include/unicodeobject.h",
+ "python_include/warnings.h",
+ "python_include/weakrefobject.h",
],
cmd = """
-cp "/opt/python3.6/include/python3.6m/code.h" "$(@D)/python_include/code.h" && cp "/opt/python3.6/include/python3.6m/dtoa.h" "$(@D)/python_include/dtoa.h" && cp "/opt/python3.6/include/python3.6m/tupleobject.h" "$(@D)/python_include/tupleobject.h" && cp "/opt/python3.6/include/python3.6m/object.h" "$(@D)/python_include/object.h" && cp "/opt/python3.6/include/python3.6m/ast.h" "$(@D)/python_include/ast.h" && cp "/opt/python3.6/include/python3.6m/pymacconfig.h" "$(@D)/python_include/pymacconfig.h" && cp "/opt/python3.6/include/python3.6m/errcode.h" "$(@D)/python_include/errcode.h" && cp "/opt/python3.6/include/python3.6m/frameobject.h" "$(@D)/python_include/frameobject.h" && cp "/opt/python3.6/include/python3.6m/typeslots.h" "$(@D)/python_include/typeslots.h" && cp "/opt/python3.6/include/python3.6m/pgenheaders.h" "$(@D)/python_include/pgenheaders.h" && cp "/opt/python3.6/include/python3.6m/cellobject.h" "$(@D)/python_include/cellobject.h" && cp "/opt/python3.6/include/python3.6m/pythread.h" "$(@D)/python_include/pythread.h" && cp "/opt/python3.6/include/python3.6m/boolobject.h" "$(@D)/python_include/boolobject.h" && cp "/opt/python3.6/include/python3.6m/accu.h" "$(@D)/python_include/accu.h" && cp "/opt/python3.6/include/python3.6m/modsupport.h" "$(@D)/python_include/modsupport.h" && cp "/opt/python3.6/include/python3.6m/import.h" "$(@D)/python_include/import.h" && cp "/opt/python3.6/include/python3.6m/pymath.h" "$(@D)/python_include/pymath.h" && cp "/opt/python3.6/include/python3.6m/node.h" "$(@D)/python_include/node.h" && cp "/opt/python3.6/include/python3.6m/funcobject.h" "$(@D)/python_include/funcobject.h" && cp "/opt/python3.6/include/python3.6m/eval.h" "$(@D)/python_include/eval.h" && cp "/opt/python3.6/include/python3.6m/pyatomic.h" "$(@D)/python_include/pyatomic.h" && cp "/opt/python3.6/include/python3.6m/longintrepr.h" "$(@D)/python_include/longintrepr.h" && cp "/opt/python3.6/include/python3.6m/floatobject.h" "$(@D)/python_include/floatobject.h" && cp "/opt/python3.6/include/python3.6m/rangeobject.h" "$(@D)/python_include/rangeobject.h" && cp "/opt/python3.6/include/python3.6m/pyfpe.h" "$(@D)/python_include/pyfpe.h" && cp "/opt/python3.6/include/python3.6m/pystrcmp.h" "$(@D)/python_include/pystrcmp.h" && cp "/opt/python3.6/include/python3.6m/fileutils.h" "$(@D)/python_include/fileutils.h" && cp "/opt/python3.6/include/python3.6m/dictobject.h" "$(@D)/python_include/dictobject.h" && cp "/opt/python3.6/include/python3.6m/pyarena.h" "$(@D)/python_include/pyarena.h" && cp "/opt/python3.6/include/python3.6m/osmodule.h" "$(@D)/python_include/osmodule.h" && cp "/opt/python3.6/include/python3.6m/objimpl.h" "$(@D)/python_include/objimpl.h" && cp "/opt/python3.6/include/python3.6m/bitset.h" "$(@D)/python_include/bitset.h" && cp "/opt/python3.6/include/python3.6m/memoryobject.h" "$(@D)/python_include/memoryobject.h" && cp "/opt/python3.6/include/python3.6m/bytearrayobject.h" "$(@D)/python_include/bytearrayobject.h" && cp "/opt/python3.6/include/python3.6m/pydebug.h" "$(@D)/python_include/pydebug.h" && cp "/opt/python3.6/include/python3.6m/pyerrors.h" "$(@D)/python_include/pyerrors.h" && cp "/opt/python3.6/include/python3.6m/weakrefobject.h" "$(@D)/python_include/weakrefobject.h" && cp "/opt/python3.6/include/python3.6m/grammar.h" "$(@D)/python_include/grammar.h" && cp "/opt/python3.6/include/python3.6m/symtable.h" "$(@D)/python_include/symtable.h" && cp "/opt/python3.6/include/python3.6m/longobject.h" "$(@D)/python_include/longobject.h" && cp "/opt/python3.6/include/python3.6m/structmember.h" "$(@D)/python_include/structmember.h" && cp "/opt/python3.6/include/python3.6m/enumobject.h" "$(@D)/python_include/enumobject.h" && cp "/opt/python3.6/include/python3.6m/pymacro.h" "$(@D)/python_include/pymacro.h" && cp "/opt/python3.6/include/python3.6m/classobject.h" "$(@D)/python_include/classobject.h" && cp "/opt/python3.6/include/python3.6m/unicodeobject.h" "$(@D)/python_include/unicodeobject.h" && cp "/opt/python3.6/include/python3.6m/sliceobject.h" "$(@D)/python_include/sliceobject.h" && cp "/opt/python3.6/include/python3.6m/pystrtod.h" "$(@D)/python_include/pystrtod.h" && cp "/opt/python3.6/include/python3.6m/genobject.h" "$(@D)/python_include/genobject.h" && cp "/opt/python3.6/include/python3.6m/compile.h" "$(@D)/python_include/compile.h" && cp "/opt/python3.6/include/python3.6m/pyexpat.h" "$(@D)/python_include/pyexpat.h" && cp "/opt/python3.6/include/python3.6m/asdl.h" "$(@D)/python_include/asdl.h" && cp "/opt/python3.6/include/python3.6m/codecs.h" "$(@D)/python_include/codecs.h" && cp "/opt/python3.6/include/python3.6m/dynamic_annotations.h" "$(@D)/python_include/dynamic_annotations.h" && cp "/opt/python3.6/include/python3.6m/pyctype.h" "$(@D)/python_include/pyctype.h" && cp "/opt/python3.6/include/python3.6m/sysmodule.h" "$(@D)/python_include/sysmodule.h" && cp "/opt/python3.6/include/python3.6m/methodobject.h" "$(@D)/python_include/methodobject.h" && cp "/opt/python3.6/include/python3.6m/graminit.h" "$(@D)/python_include/graminit.h" && cp "/opt/python3.6/include/python3.6m/bltinmodule.h" "$(@D)/python_include/bltinmodule.h" && cp "/opt/python3.6/include/python3.6m/intrcheck.h" "$(@D)/python_include/intrcheck.h" && cp "/opt/python3.6/include/python3.6m/pyport.h" "$(@D)/python_include/pyport.h" && cp "/opt/python3.6/include/python3.6m/warnings.h" "$(@D)/python_include/warnings.h" && cp "/opt/python3.6/include/python3.6m/osdefs.h" "$(@D)/python_include/osdefs.h" && cp "/opt/python3.6/include/python3.6m/pydtrace.h" "$(@D)/python_include/pydtrace.h" && cp "/opt/python3.6/include/python3.6m/pylifecycle.h" "$(@D)/python_include/pylifecycle.h" && cp "/opt/python3.6/include/python3.6m/fileobject.h" "$(@D)/python_include/fileobject.h" && cp "/opt/python3.6/include/python3.6m/pytime.h" "$(@D)/python_include/pytime.h" && cp "/opt/python3.6/include/python3.6m/traceback.h" "$(@D)/python_include/traceback.h" && cp "/opt/python3.6/include/python3.6m/ceval.h" "$(@D)/python_include/ceval.h" && cp "/opt/python3.6/include/python3.6m/bytes_methods.h" "$(@D)/python_include/bytes_methods.h" && cp "/opt/python3.6/include/python3.6m/namespaceobject.h" "$(@D)/python_include/namespaceobject.h" && cp "/opt/python3.6/include/python3.6m/pyconfig.h" "$(@D)/python_include/pyconfig.h" && cp "/opt/python3.6/include/python3.6m/Python.h" "$(@D)/python_include/Python.h" && cp "/opt/python3.6/include/python3.6m/moduleobject.h" "$(@D)/python_include/moduleobject.h" && cp "/opt/python3.6/include/python3.6m/pystate.h" "$(@D)/python_include/pystate.h" && cp "/opt/python3.6/include/python3.6m/descrobject.h" "$(@D)/python_include/descrobject.h" && cp "/opt/python3.6/include/python3.6m/odictobject.h" "$(@D)/python_include/odictobject.h" && cp "/opt/python3.6/include/python3.6m/ucnhash.h" "$(@D)/python_include/ucnhash.h" && cp "/opt/python3.6/include/python3.6m/pygetopt.h" "$(@D)/python_include/pygetopt.h" && cp "/opt/python3.6/include/python3.6m/pymem.h" "$(@D)/python_include/pymem.h" && cp "/opt/python3.6/include/python3.6m/complexobject.h" "$(@D)/python_include/complexobject.h" && cp "/opt/python3.6/include/python3.6m/structseq.h" "$(@D)/python_include/structseq.h" && cp "/opt/python3.6/include/python3.6m/datetime.h" "$(@D)/python_include/datetime.h" && cp "/opt/python3.6/include/python3.6m/pythonrun.h" "$(@D)/python_include/pythonrun.h" && cp "/opt/python3.6/include/python3.6m/pyhash.h" "$(@D)/python_include/pyhash.h" && cp "/opt/python3.6/include/python3.6m/pycapsule.h" "$(@D)/python_include/pycapsule.h" && cp "/opt/python3.6/include/python3.6m/setobject.h" "$(@D)/python_include/setobject.h" && cp "/opt/python3.6/include/python3.6m/listobject.h" "$(@D)/python_include/listobject.h" && cp "/opt/python3.6/include/python3.6m/bytesobject.h" "$(@D)/python_include/bytesobject.h" && cp "/opt/python3.6/include/python3.6m/pgen.h" "$(@D)/python_include/pgen.h" && cp "/opt/python3.6/include/python3.6m/patchlevel.h" "$(@D)/python_include/patchlevel.h" && cp "/opt/python3.6/include/python3.6m/opcode.h" "$(@D)/python_include/opcode.h" && cp "/opt/python3.6/include/python3.6m/parsetok.h" "$(@D)/python_include/parsetok.h" && cp "/opt/python3.6/include/python3.6m/pystrhex.h" "$(@D)/python_include/pystrhex.h" && cp "/opt/python3.6/include/python3.6m/marshal.h" "$(@D)/python_include/marshal.h" && cp "/opt/python3.6/include/python3.6m/token.h" "$(@D)/python_include/token.h" && cp "/opt/python3.6/include/python3.6m/iterobject.h" "$(@D)/python_include/iterobject.h" && cp "/opt/python3.6/include/python3.6m/abstract.h" "$(@D)/python_include/abstract.h" && cp "/opt/python3.6/include/python3.6m/py_curses.h" "$(@D)/python_include/py_curses.h" && cp "/opt/python3.6/include/python3.6m/metagrammar.h" "$(@D)/python_include/metagrammar.h" && cp "/opt/python3.6/include/python3.6m/Python-ast.h" "$(@D)/python_include/Python-ast.h"
+cp "/opt/python3.6/include/python3.6m/Python-ast.h" "$(@D)/python_include/Python-ast.h" && cp "/opt/python3.6/include/python3.6m/Python.h" "$(@D)/python_include/Python.h" && cp "/opt/python3.6/include/python3.6m/abstract.h" "$(@D)/python_include/abstract.h" && cp "/opt/python3.6/include/python3.6m/accu.h" "$(@D)/python_include/accu.h" && cp "/opt/python3.6/include/python3.6m/asdl.h" "$(@D)/python_include/asdl.h" && cp "/opt/python3.6/include/python3.6m/ast.h" "$(@D)/python_include/ast.h" && cp "/opt/python3.6/include/python3.6m/bitset.h" "$(@D)/python_include/bitset.h" && cp "/opt/python3.6/include/python3.6m/bltinmodule.h" "$(@D)/python_include/bltinmodule.h" && cp "/opt/python3.6/include/python3.6m/boolobject.h" "$(@D)/python_include/boolobject.h" && cp "/opt/python3.6/include/python3.6m/bytearrayobject.h" "$(@D)/python_include/bytearrayobject.h" && cp "/opt/python3.6/include/python3.6m/bytes_methods.h" "$(@D)/python_include/bytes_methods.h" && cp "/opt/python3.6/include/python3.6m/bytesobject.h" "$(@D)/python_include/bytesobject.h" && cp "/opt/python3.6/include/python3.6m/cellobject.h" "$(@D)/python_include/cellobject.h" && cp "/opt/python3.6/include/python3.6m/ceval.h" "$(@D)/python_include/ceval.h" && cp "/opt/python3.6/include/python3.6m/classobject.h" "$(@D)/python_include/classobject.h" && cp "/opt/python3.6/include/python3.6m/code.h" "$(@D)/python_include/code.h" && cp "/opt/python3.6/include/python3.6m/codecs.h" "$(@D)/python_include/codecs.h" && cp "/opt/python3.6/include/python3.6m/compile.h" "$(@D)/python_include/compile.h" && cp "/opt/python3.6/include/python3.6m/complexobject.h" "$(@D)/python_include/complexobject.h" && cp "/opt/python3.6/include/python3.6m/datetime.h" "$(@D)/python_include/datetime.h" && cp "/opt/python3.6/include/python3.6m/descrobject.h" "$(@D)/python_include/descrobject.h" && cp "/opt/python3.6/include/python3.6m/dictobject.h" "$(@D)/python_include/dictobject.h" && cp "/opt/python3.6/include/python3.6m/dtoa.h" "$(@D)/python_include/dtoa.h" && cp "/opt/python3.6/include/python3.6m/dynamic_annotations.h" "$(@D)/python_include/dynamic_annotations.h" && cp "/opt/python3.6/include/python3.6m/enumobject.h" "$(@D)/python_include/enumobject.h" && cp "/opt/python3.6/include/python3.6m/errcode.h" "$(@D)/python_include/errcode.h" && cp "/opt/python3.6/include/python3.6m/eval.h" "$(@D)/python_include/eval.h" && cp "/opt/python3.6/include/python3.6m/fileobject.h" "$(@D)/python_include/fileobject.h" && cp "/opt/python3.6/include/python3.6m/fileutils.h" "$(@D)/python_include/fileutils.h" && cp "/opt/python3.6/include/python3.6m/floatobject.h" "$(@D)/python_include/floatobject.h" && cp "/opt/python3.6/include/python3.6m/frameobject.h" "$(@D)/python_include/frameobject.h" && cp "/opt/python3.6/include/python3.6m/funcobject.h" "$(@D)/python_include/funcobject.h" && cp "/opt/python3.6/include/python3.6m/genobject.h" "$(@D)/python_include/genobject.h" && cp "/opt/python3.6/include/python3.6m/graminit.h" "$(@D)/python_include/graminit.h" && cp "/opt/python3.6/include/python3.6m/grammar.h" "$(@D)/python_include/grammar.h" && cp "/opt/python3.6/include/python3.6m/import.h" "$(@D)/python_include/import.h" && cp "/opt/python3.6/include/python3.6m/intrcheck.h" "$(@D)/python_include/intrcheck.h" && cp "/opt/python3.6/include/python3.6m/iterobject.h" "$(@D)/python_include/iterobject.h" && cp "/opt/python3.6/include/python3.6m/listobject.h" "$(@D)/python_include/listobject.h" && cp "/opt/python3.6/include/python3.6m/longintrepr.h" "$(@D)/python_include/longintrepr.h" && cp "/opt/python3.6/include/python3.6m/longobject.h" "$(@D)/python_include/longobject.h" && cp "/opt/python3.6/include/python3.6m/marshal.h" "$(@D)/python_include/marshal.h" && cp "/opt/python3.6/include/python3.6m/memoryobject.h" "$(@D)/python_include/memoryobject.h" && cp "/opt/python3.6/include/python3.6m/metagrammar.h" "$(@D)/python_include/metagrammar.h" && cp "/opt/python3.6/include/python3.6m/methodobject.h" "$(@D)/python_include/methodobject.h" && cp "/opt/python3.6/include/python3.6m/modsupport.h" "$(@D)/python_include/modsupport.h" && cp "/opt/python3.6/include/python3.6m/moduleobject.h" "$(@D)/python_include/moduleobject.h" && cp "/opt/python3.6/include/python3.6m/namespaceobject.h" "$(@D)/python_include/namespaceobject.h" && cp "/opt/python3.6/include/python3.6m/node.h" "$(@D)/python_include/node.h" && cp "/opt/python3.6/include/python3.6m/object.h" "$(@D)/python_include/object.h" && cp "/opt/python3.6/include/python3.6m/objimpl.h" "$(@D)/python_include/objimpl.h" && cp "/opt/python3.6/include/python3.6m/odictobject.h" "$(@D)/python_include/odictobject.h" && cp "/opt/python3.6/include/python3.6m/opcode.h" "$(@D)/python_include/opcode.h" && cp "/opt/python3.6/include/python3.6m/osdefs.h" "$(@D)/python_include/osdefs.h" && cp "/opt/python3.6/include/python3.6m/osmodule.h" "$(@D)/python_include/osmodule.h" && cp "/opt/python3.6/include/python3.6m/parsetok.h" "$(@D)/python_include/parsetok.h" && cp "/opt/python3.6/include/python3.6m/patchlevel.h" "$(@D)/python_include/patchlevel.h" && cp "/opt/python3.6/include/python3.6m/pgen.h" "$(@D)/python_include/pgen.h" && cp "/opt/python3.6/include/python3.6m/pgenheaders.h" "$(@D)/python_include/pgenheaders.h" && cp "/opt/python3.6/include/python3.6m/py_curses.h" "$(@D)/python_include/py_curses.h" && cp "/opt/python3.6/include/python3.6m/pyarena.h" "$(@D)/python_include/pyarena.h" && cp "/opt/python3.6/include/python3.6m/pyatomic.h" "$(@D)/python_include/pyatomic.h" && cp "/opt/python3.6/include/python3.6m/pycapsule.h" "$(@D)/python_include/pycapsule.h" && cp "/opt/python3.6/include/python3.6m/pyconfig.h" "$(@D)/python_include/pyconfig.h" && cp "/opt/python3.6/include/python3.6m/pyctype.h" "$(@D)/python_include/pyctype.h" && cp "/opt/python3.6/include/python3.6m/pydebug.h" "$(@D)/python_include/pydebug.h" && cp "/opt/python3.6/include/python3.6m/pydtrace.h" "$(@D)/python_include/pydtrace.h" && cp "/opt/python3.6/include/python3.6m/pyerrors.h" "$(@D)/python_include/pyerrors.h" && cp "/opt/python3.6/include/python3.6m/pyexpat.h" "$(@D)/python_include/pyexpat.h" && cp "/opt/python3.6/include/python3.6m/pyfpe.h" "$(@D)/python_include/pyfpe.h" && cp "/opt/python3.6/include/python3.6m/pygetopt.h" "$(@D)/python_include/pygetopt.h" && cp "/opt/python3.6/include/python3.6m/pyhash.h" "$(@D)/python_include/pyhash.h" && cp "/opt/python3.6/include/python3.6m/pylifecycle.h" "$(@D)/python_include/pylifecycle.h" && cp "/opt/python3.6/include/python3.6m/pymacconfig.h" "$(@D)/python_include/pymacconfig.h" && cp "/opt/python3.6/include/python3.6m/pymacro.h" "$(@D)/python_include/pymacro.h" && cp "/opt/python3.6/include/python3.6m/pymath.h" "$(@D)/python_include/pymath.h" && cp "/opt/python3.6/include/python3.6m/pymem.h" "$(@D)/python_include/pymem.h" && cp "/opt/python3.6/include/python3.6m/pyport.h" "$(@D)/python_include/pyport.h" && cp "/opt/python3.6/include/python3.6m/pystate.h" "$(@D)/python_include/pystate.h" && cp "/opt/python3.6/include/python3.6m/pystrcmp.h" "$(@D)/python_include/pystrcmp.h" && cp "/opt/python3.6/include/python3.6m/pystrhex.h" "$(@D)/python_include/pystrhex.h" && cp "/opt/python3.6/include/python3.6m/pystrtod.h" "$(@D)/python_include/pystrtod.h" && cp "/opt/python3.6/include/python3.6m/pythonrun.h" "$(@D)/python_include/pythonrun.h" && cp "/opt/python3.6/include/python3.6m/pythread.h" "$(@D)/python_include/pythread.h" && cp "/opt/python3.6/include/python3.6m/pytime.h" "$(@D)/python_include/pytime.h" && cp "/opt/python3.6/include/python3.6m/rangeobject.h" "$(@D)/python_include/rangeobject.h" && cp "/opt/python3.6/include/python3.6m/setobject.h" "$(@D)/python_include/setobject.h" && cp "/opt/python3.6/include/python3.6m/sliceobject.h" "$(@D)/python_include/sliceobject.h" && cp "/opt/python3.6/include/python3.6m/structmember.h" "$(@D)/python_include/structmember.h" && cp "/opt/python3.6/include/python3.6m/structseq.h" "$(@D)/python_include/structseq.h" && cp "/opt/python3.6/include/python3.6m/symtable.h" "$(@D)/python_include/symtable.h" && cp "/opt/python3.6/include/python3.6m/sysmodule.h" "$(@D)/python_include/sysmodule.h" && cp "/opt/python3.6/include/python3.6m/token.h" "$(@D)/python_include/token.h" && cp "/opt/python3.6/include/python3.6m/traceback.h" "$(@D)/python_include/traceback.h" && cp "/opt/python3.6/include/python3.6m/tupleobject.h" "$(@D)/python_include/tupleobject.h" && cp "/opt/python3.6/include/python3.6m/typeslots.h" "$(@D)/python_include/typeslots.h" && cp "/opt/python3.6/include/python3.6m/ucnhash.h" "$(@D)/python_include/ucnhash.h" && cp "/opt/python3.6/include/python3.6m/unicodeobject.h" "$(@D)/python_include/unicodeobject.h" && cp "/opt/python3.6/include/python3.6m/warnings.h" "$(@D)/python_include/warnings.h" && cp "/opt/python3.6/include/python3.6m/weakrefobject.h" "$(@D)/python_include/weakrefobject.h"
""",
)
genrule(
name = "numpy_include",
outs = [
- "numpy_include/numpy/oldnumeric.h",
- "numpy_include/numpy/npy_1_7_deprecated_api.h",
- "numpy_include/numpy/ufunc_api.txt",
- "numpy_include/numpy/multiarray_api.txt",
- "numpy_include/numpy/halffloat.h",
- "numpy_include/numpy/npy_common.h",
- "numpy_include/numpy/utils.h",
- "numpy_include/numpy/npy_interrupt.h",
- "numpy_include/numpy/npy_endian.h",
+ "numpy_include/numpy/__multiarray_api.h",
"numpy_include/numpy/__ufunc_api.h",
"numpy_include/numpy/_neighborhood_iterator_imp.h",
- "numpy_include/numpy/ufuncobject.h",
+ "numpy_include/numpy/_numpyconfig.h",
+ "numpy_include/numpy/arrayobject.h",
+ "numpy_include/numpy/arrayscalars.h",
+ "numpy_include/numpy/halffloat.h",
+ "numpy_include/numpy/multiarray_api.txt",
+ "numpy_include/numpy/ndarrayobject.h",
"numpy_include/numpy/ndarraytypes.h",
- "numpy_include/numpy/npy_math.h",
"numpy_include/numpy/noprefix.h",
+ "numpy_include/numpy/npy_1_7_deprecated_api.h",
"numpy_include/numpy/npy_3kcompat.h",
- "numpy_include/numpy/arrayscalars.h",
- "numpy_include/numpy/npy_os.h",
- "numpy_include/numpy/ndarrayobject.h",
- "numpy_include/numpy/npy_no_deprecated_api.h",
- "numpy_include/numpy/arrayobject.h",
- "numpy_include/numpy/_numpyconfig.h",
- "numpy_include/numpy/__multiarray_api.h",
+ "numpy_include/numpy/npy_common.h",
"numpy_include/numpy/npy_cpu.h",
- "numpy_include/numpy/old_defines.h",
+ "numpy_include/numpy/npy_endian.h",
+ "numpy_include/numpy/npy_interrupt.h",
+ "numpy_include/numpy/npy_math.h",
+ "numpy_include/numpy/npy_no_deprecated_api.h",
+ "numpy_include/numpy/npy_os.h",
"numpy_include/numpy/numpyconfig.h",
+ "numpy_include/numpy/old_defines.h",
+ "numpy_include/numpy/oldnumeric.h",
+ "numpy_include/numpy/ufunc_api.txt",
+ "numpy_include/numpy/ufuncobject.h",
+ "numpy_include/numpy/utils.h",
],
cmd = """
-cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/oldnumeric.h" "$(@D)/numpy_include/numpy/oldnumeric.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_1_7_deprecated_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ufunc_api.txt" "$(@D)/numpy_include/numpy/ufunc_api.txt" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/multiarray_api.txt" "$(@D)/numpy_include/numpy/multiarray_api.txt" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/halffloat.h" "$(@D)/numpy_include/numpy/halffloat.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_common.h" "$(@D)/numpy_include/numpy/npy_common.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/utils.h" "$(@D)/numpy_include/numpy/utils.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_interrupt.h" "$(@D)/numpy_include/numpy/npy_interrupt.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_endian.h" "$(@D)/numpy_include/numpy/npy_endian.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/__ufunc_api.h" "$(@D)/numpy_include/numpy/__ufunc_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/_neighborhood_iterator_imp.h" "$(@D)/numpy_include/numpy/_neighborhood_iterator_imp.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ufuncobject.h" "$(@D)/numpy_include/numpy/ufuncobject.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h" "$(@D)/numpy_include/numpy/ndarraytypes.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_math.h" "$(@D)/numpy_include/numpy/npy_math.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/noprefix.h" "$(@D)/numpy_include/numpy/noprefix.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_3kcompat.h" "$(@D)/numpy_include/numpy/npy_3kcompat.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/arrayscalars.h" "$(@D)/numpy_include/numpy/arrayscalars.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_os.h" "$(@D)/numpy_include/numpy/npy_os.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h" "$(@D)/numpy_include/numpy/ndarrayobject.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_no_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_no_deprecated_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h" "$(@D)/numpy_include/numpy/arrayobject.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/_numpyconfig.h" "$(@D)/numpy_include/numpy/_numpyconfig.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/__multiarray_api.h" "$(@D)/numpy_include/numpy/__multiarray_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_cpu.h" "$(@D)/numpy_include/numpy/npy_cpu.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/old_defines.h" "$(@D)/numpy_include/numpy/old_defines.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/numpyconfig.h" "$(@D)/numpy_include/numpy/numpyconfig.h"
+cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/__multiarray_api.h" "$(@D)/numpy_include/numpy/__multiarray_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/__ufunc_api.h" "$(@D)/numpy_include/numpy/__ufunc_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/_neighborhood_iterator_imp.h" "$(@D)/numpy_include/numpy/_neighborhood_iterator_imp.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/_numpyconfig.h" "$(@D)/numpy_include/numpy/_numpyconfig.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h" "$(@D)/numpy_include/numpy/arrayobject.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/arrayscalars.h" "$(@D)/numpy_include/numpy/arrayscalars.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/halffloat.h" "$(@D)/numpy_include/numpy/halffloat.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/multiarray_api.txt" "$(@D)/numpy_include/numpy/multiarray_api.txt" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h" "$(@D)/numpy_include/numpy/ndarrayobject.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h" "$(@D)/numpy_include/numpy/ndarraytypes.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/noprefix.h" "$(@D)/numpy_include/numpy/noprefix.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_1_7_deprecated_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_3kcompat.h" "$(@D)/numpy_include/numpy/npy_3kcompat.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_common.h" "$(@D)/numpy_include/numpy/npy_common.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_cpu.h" "$(@D)/numpy_include/numpy/npy_cpu.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_endian.h" "$(@D)/numpy_include/numpy/npy_endian.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_interrupt.h" "$(@D)/numpy_include/numpy/npy_interrupt.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_math.h" "$(@D)/numpy_include/numpy/npy_math.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_no_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_no_deprecated_api.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/npy_os.h" "$(@D)/numpy_include/numpy/npy_os.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/numpyconfig.h" "$(@D)/numpy_include/numpy/numpyconfig.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/old_defines.h" "$(@D)/numpy_include/numpy/old_defines.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/oldnumeric.h" "$(@D)/numpy_include/numpy/oldnumeric.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ufunc_api.txt" "$(@D)/numpy_include/numpy/ufunc_api.txt" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/ufuncobject.h" "$(@D)/numpy_include/numpy/ufuncobject.h" && cp "/opt/python3.6/lib/python3.6/site-packages/numpy/core/include/numpy/utils.h" "$(@D)/numpy_include/numpy/utils.h"
""",
)
--
GitLab
From f283e65a1bdb797070be9b84a69ef323268f7c3c Mon Sep 17 00:00:00 2001
From: Tom Hennigan
Date: Tue, 5 Jun 2018 03:56:47 -0700
Subject: [PATCH 041/519] Handle scalar input to assert_equal in eager.
PiperOrigin-RevId: 199274329
---
tensorflow/python/kernel_tests/check_ops_test.py | 7 +++++++
tensorflow/python/ops/check_ops.py | 4 ++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/tensorflow/python/kernel_tests/check_ops_test.py b/tensorflow/python/kernel_tests/check_ops_test.py
index 5a83ec8d30..7ef841c96b 100644
--- a/tensorflow/python/kernel_tests/check_ops_test.py
+++ b/tensorflow/python/kernel_tests/check_ops_test.py
@@ -88,6 +88,13 @@ class AssertEqualTest(test.TestCase):
out = array_ops.identity(small)
self.evaluate(out)
+ @test_util.run_in_graph_and_eager_modes()
+ def test_scalar_comparison(self):
+ const_true = constant_op.constant(True, name="true")
+ const_false = constant_op.constant(False, name="false")
+ with self.assertRaisesRegexp(errors.InvalidArgumentError, "fail"):
+ check_ops.assert_equal(const_true, const_false, message="fail")
+
def test_returns_none_with_eager(self):
with context.eager_mode():
small = constant_op.constant([1, 2], name="small")
diff --git a/tensorflow/python/ops/check_ops.py b/tensorflow/python/ops/check_ops.py
index cabc1e724c..375a5ec2c3 100644
--- a/tensorflow/python/ops/check_ops.py
+++ b/tensorflow/python/ops/check_ops.py
@@ -341,8 +341,8 @@ def assert_equal(x, y, data=None, summarize=None, message=None, name=None):
y_sum, y_np[:y_sum]))
index_and_values_str = ''
- if x.shape == y.shape:
- # If the shapes of x and y are the same,
+ if x.shape == y.shape and x.shape.as_list():
+ # If the shapes of x and y are the same (and not scalars),
# Get the values that actually differed and their indices.
# If shapes are different this information is more confusing
# than useful.
--
GitLab
From e71f9b863097086c91b2a3f5aea1e081f275ceca Mon Sep 17 00:00:00 2001
From: "A. Unique TensorFlower"
Date: Thu, 21 Jun 2018 18:53:05 -0700
Subject: [PATCH 042/519] Update Eigen version to commit
e5e305a158a029f5b5f837bf821411a51439a970.
PiperOrigin-RevId: 201624024
---
.../distributions/dirichlet_multinomial_test.py | 6 +++---
tensorflow/workspace.bzl | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/tensorflow/python/kernel_tests/distributions/dirichlet_multinomial_test.py b/tensorflow/python/kernel_tests/distributions/dirichlet_multinomial_test.py
index 7922fb0606..daea699514 100644
--- a/tensorflow/python/kernel_tests/distributions/dirichlet_multinomial_test.py
+++ b/tensorflow/python/kernel_tests/distributions/dirichlet_multinomial_test.py
@@ -250,9 +250,9 @@ class DirichletMultinomialTest(test.TestCase):
dist.variance(),
dist.stddev(),
])
- self.assertAllClose(sample_mean_, analytic_mean, atol=0., rtol=0.04)
- self.assertAllClose(sample_cov_, analytic_cov, atol=0., rtol=0.05)
- self.assertAllClose(sample_var_, analytic_var, atol=0., rtol=0.05)
+ self.assertAllClose(sample_mean_, analytic_mean, atol=0., rtol=0.06)
+ self.assertAllClose(sample_cov_, analytic_cov, atol=0., rtol=0.07)
+ self.assertAllClose(sample_var_, analytic_var, atol=0., rtol=0.07)
self.assertAllClose(sample_stddev_, analytic_stddev, atol=0., rtol=0.02)
def testCovariance(self):
diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl
index 50a69598a1..43152c88cf 100644
--- a/tensorflow/workspace.bzl
+++ b/tensorflow/workspace.bzl
@@ -107,11 +107,11 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
tf_http_archive(
name = "eigen_archive",
urls = [
- "https://mirror.bazel.build/bitbucket.org/eigen/eigen/get/6913f0cf7d06.tar.gz",
- "https://bitbucket.org/eigen/eigen/get/6913f0cf7d06.tar.gz",
+ "https://mirror.bazel.build/bitbucket.org/eigen/eigen/get/e5e305a158a0.tar.gz",
+ "https://bitbucket.org/eigen/eigen/get/e5e305a158a0.tar.gz",
],
- sha256 = "791b836cacd03e20bae5bdd25f1c4a5505a0a9975ba94a61eb4e2631fbd1d53a",
- strip_prefix = "eigen-eigen-6913f0cf7d06",
+ sha256 = "8bbe676d69e7f59070c83a949454b8b6344034e0ebbf686b337528e5dc04c7de",
+ strip_prefix = "eigen-eigen-e5e305a158a0",
build_file = clean_dep("//third_party:eigen.BUILD"),
patch_file = clean_dep("//third_party:eigen_fix_cuda_compilation.patch")
)
--
GitLab
From 5c450d2e1d0d3a1abae4997df0da1b8d73684e01 Mon Sep 17 00:00:00 2001
From: Rasmus Munk Larsen
Date: Fri, 22 Jun 2018 13:36:57 -0700
Subject: [PATCH 043/519] Update workspace.bzl
---
tensorflow/workspace.bzl | 1 -
1 file changed, 1 deletion(-)
diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl
index 43152c88cf..3c657c4a5b 100644
--- a/tensorflow/workspace.bzl
+++ b/tensorflow/workspace.bzl
@@ -113,7 +113,6 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
sha256 = "8bbe676d69e7f59070c83a949454b8b6344034e0ebbf686b337528e5dc04c7de",
strip_prefix = "eigen-eigen-e5e305a158a0",
build_file = clean_dep("//third_party:eigen.BUILD"),
- patch_file = clean_dep("//third_party:eigen_fix_cuda_compilation.patch")
)
tf_http_archive(
--
GitLab
From df2c8315211895afab0d7ba1ff64e831d9d3ce3b Mon Sep 17 00:00:00 2001
From: Billy Lamberta
Date: Tue, 19 Jun 2018 23:11:00 -0700
Subject: [PATCH 044/519] Get started landing page. Move "Datasets Quickstart"
to "Datasets for Estimators" under guide.
PiperOrigin-RevId: 201301717
---
tensorflow/docs_src/get_started/_index.yaml | 255 ++++++++++++++++++
.../get_started/basic_classification.md | 3 +
.../docs_src/get_started/basic_regression.md | 3 +
.../get_started/basic_text_classification.md | 3 +
tensorflow/docs_src/get_started/eager.md | 2 +-
tensorflow/docs_src/get_started/index.md | 29 --
tensorflow/docs_src/get_started/leftnav_files | 12 +-
tensorflow/docs_src/get_started/next_steps.md | 36 +++
.../get_started/overfit_and_underfit.md | 3 +
.../get_started/save_and_restore_models.md | 3 +
tensorflow/docs_src/install/install_linux.md | 8 +-
tensorflow/docs_src/install/install_mac.md | 6 +-
.../docs_src/install/install_raspbian.md | 6 +-
.../docs_src/install/install_sources.md | 2 +-
.../docs_src/install/install_windows.md | 7 +-
.../datasets_for_estimators.md} | 2 +-
.../docs_src/programmers_guide/index.md | 1 +
.../docs_src/programmers_guide/leftnav_files | 1 +
.../programmers_guide/premade_estimators.md | 8 +-
tensorflow/docs_src/tutorials/index.md | 5 +-
20 files changed, 329 insertions(+), 66 deletions(-)
create mode 100644 tensorflow/docs_src/get_started/_index.yaml
create mode 100644 tensorflow/docs_src/get_started/basic_classification.md
create mode 100644 tensorflow/docs_src/get_started/basic_regression.md
create mode 100644 tensorflow/docs_src/get_started/basic_text_classification.md
delete mode 100644 tensorflow/docs_src/get_started/index.md
create mode 100644 tensorflow/docs_src/get_started/next_steps.md
create mode 100644 tensorflow/docs_src/get_started/overfit_and_underfit.md
create mode 100644 tensorflow/docs_src/get_started/save_and_restore_models.md
rename tensorflow/docs_src/{get_started/datasets_quickstart.md => programmers_guide/datasets_for_estimators.md} (99%)
diff --git a/tensorflow/docs_src/get_started/_index.yaml b/tensorflow/docs_src/get_started/_index.yaml
new file mode 100644
index 0000000000..af255a482d
--- /dev/null
+++ b/tensorflow/docs_src/get_started/_index.yaml
@@ -0,0 +1,255 @@
+project_path: /_project.yaml
+book_path: /_book.yaml
+description:
+landing_page:
+ show_side_navs: True
+ rows:
+ - description: >
+ Get Started with TensorFlow
+
+ TensorFlow is an open-source machine learning library for research and
+ production. TensorFlow offers APIs for beginners and experts to develop
+ for desktop, mobile, web, and cloud. See the sections below to get
+ started.
+
+ items:
+ - custom_html: >
+
+
+ - classname: tfo-landing-row-item-code-block
+ code_block: |
+
+ import tensorflow as tf
+ mnist = tf.keras.datasets.mnist
+
+ (x_train, y_train),(x_test, y_test) = mnist.load_data()
+ x_train, x_test = x_train / 255.0, x_test / 255.0
+
+ model = tf.keras.models.Sequential([
+ tf.keras.layers.Flatten(),
+ tf.keras.layers.Dense(512, activation=tf.nn.relu),
+ tf.keras.layers.Dropout(0.2),
+ tf.keras.layers.Dense(10, activation=tf.nn.softmax)
+ ])
+ model.compile(optimizer='adam',
+ loss='sparse_categorical_crossentropy',
+ metrics=['accuracy'])
+
+ model.fit(x_train, y_train, epochs=5)
+ model.evaluate(x_test, y_test)
+
+ {% dynamic if request.tld != 'cn' %}
+ Run in a Notebook
+ {% dynamic endif %}
+
+ - items:
+ - custom_html: >
+
+ - custom_html: >
+
+
+ - description: >
+ Google Colab: An easy way to learn and use TensorFlow
+
+ Colaboratory
+ is a Google research project created to help disseminate machine learning
+ education and research. It's a Jupyter notebook environment that requires
+ no setup to use and runs entirely in the cloud.
+ Read the blog post.
+
+
+ - description: >
+ Build your first ML app
+ Create and deploy TensorFlow models on web and mobile.
+ background: grey
+ items:
+ - custom_html: >
+
+
+ Web developers
+
+
+ TensorFlow.js is a WebGL accelerated, JavaScript library to train and
+ deploy ML models in the browser and for Node.js.
+
+
+ - custom_html: >
+
+
+ - description: >
+ Videos and updates
+
+ Subscribe to the TensorFlow
+ YouTube channel
+ and blog for
+ the latest videos and updates.
+
+ items:
+ - description: >
+ Get started with TensorFlow's High-Level APIs
+ youtube_id: tjsHSIG8I08
+ buttons:
+ - label: Watch the video
+ path: https://www.youtube.com/watch?v=tjsHSIG8I08
+ - description: >
+ Eager execution
+ youtube_id: T8AW0fKP0Hs
+ background: grey
+ buttons:
+ - label: Watch the video
+ path: https://www.youtube.com/watch?v=T8AW0fKP0Hs
+ - description: >
+ tf.data: Fast, flexible, and easy-to-use input pipelines
+ youtube_id: uIcqeP7MFH0
+ buttons:
+ - label: Watch the video
+ path: https://www.youtube.com/watch?v=uIcqeP7MFH0
diff --git a/tensorflow/docs_src/get_started/basic_classification.md b/tensorflow/docs_src/get_started/basic_classification.md
new file mode 100644
index 0000000000..91bbd85b24
--- /dev/null
+++ b/tensorflow/docs_src/get_started/basic_classification.md
@@ -0,0 +1,3 @@
+# Basic Classification
+
+[Colab notebook](https://colab.research.google.com/github/tensorflow/models/blob/master/samples/core/get_started/basic_classification.ipynb)
diff --git a/tensorflow/docs_src/get_started/basic_regression.md b/tensorflow/docs_src/get_started/basic_regression.md
new file mode 100644
index 0000000000..a535f22f5a
--- /dev/null
+++ b/tensorflow/docs_src/get_started/basic_regression.md
@@ -0,0 +1,3 @@
+# Basic Regression
+
+[Colab notebook](https://colab.research.google.com/github/tensorflow/models/blob/master/samples/core/get_started/basic_regression.ipynb)
diff --git a/tensorflow/docs_src/get_started/basic_text_classification.md b/tensorflow/docs_src/get_started/basic_text_classification.md
new file mode 100644
index 0000000000..7c5d4f7896
--- /dev/null
+++ b/tensorflow/docs_src/get_started/basic_text_classification.md
@@ -0,0 +1,3 @@
+# Basic Text Classification
+
+[Colab notebook](https://colab.research.google.com/github/tensorflow/models/blob/master/samples/core/get_started/basic_text_classification.ipynb)
diff --git a/tensorflow/docs_src/get_started/eager.md b/tensorflow/docs_src/get_started/eager.md
index bbb25e20c6..ddf239485a 100644
--- a/tensorflow/docs_src/get_started/eager.md
+++ b/tensorflow/docs_src/get_started/eager.md
@@ -1,3 +1,3 @@
-# Get Started with Eager Execution
+# Custom Training Walkthrough
[Colab notebook](https://colab.research.google.com/github/tensorflow/models/blob/r1.9.0/samples/core/get_started/eager.ipynb)
diff --git a/tensorflow/docs_src/get_started/index.md b/tensorflow/docs_src/get_started/index.md
deleted file mode 100644
index 232d2f1547..0000000000
--- a/tensorflow/docs_src/get_started/index.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# Get Started
-
-If you are new to machine learning, we recommend taking the following online
-course prior to diving into TensorFlow documentation:
-
- * [Machine Learning Crash Course](https://developers.google.com/machine-learning/crash-course/),
- which introduces machine learning concepts and encourages experimentation
- with existing TensorFlow code.
-
-TensorFlow is a tool for machine learning. While it contains a wide range of
-functionality, TensorFlow is mainly designed for deep neural network models.
-
-The easiest way to get started with TensorFlow is by using Eager Execution.
-
- * @{$get_started/eager}, is for anyone new to machine learning or TensorFlow.
-
-TensorFlow provides many APIs. The remainder of this section focuses on the
-Estimator API which provide scalable, high-performance models. See the
-@{$estimators} guide.
-
-For more advanced users:
-
- * The @{$low_level_intro$Low Level Introduction} demonstrates how to use
- TensorFlow outside of the Estimator framework, for debugging and
- experimentation.
- * The @{$programmers_guide$Programmer's Guide} details major
- TensorFlow components.
- * The @{$tutorials$Tutorials} provide walkthroughs of a variety of
- TensorFlow models.
diff --git a/tensorflow/docs_src/get_started/leftnav_files b/tensorflow/docs_src/get_started/leftnav_files
index e6cc8d5658..9a60496cb5 100644
--- a/tensorflow/docs_src/get_started/leftnav_files
+++ b/tensorflow/docs_src/get_started/leftnav_files
@@ -1,4 +1,10 @@
-index.md
+### Learn and use ML
+basic_classification.md
+basic_text_classification.md
+basic_regression.md
+overfit_and_underfit.md
+save_and_restore_models.md
+next_steps.md
-eager.md
-datasets_quickstart.md
+### Research and experimentation
+custom_training_walkthrough.md
diff --git a/tensorflow/docs_src/get_started/next_steps.md b/tensorflow/docs_src/get_started/next_steps.md
new file mode 100644
index 0000000000..79c0ef3346
--- /dev/null
+++ b/tensorflow/docs_src/get_started/next_steps.md
@@ -0,0 +1,36 @@
+# Next Steps
+
+## Learn more about TensorFlow
+
+* The [TensorFlow Guide](/programmers_guide) includes usage guides for the
+ high-level APIs, as well as advanced TensorFlow operations.
+* [Premade Estimators](/programmers_guide/premade_estimators) are designed to
+ get results out of the box. Use TensorFlow without building your own models.
+* [TensorFlow.js](https://js.tensorflow.org/) allows web developers to train and
+ deploy ML models in the browser and using Node.js.
+* [TFLite](/mobile/tflite) allows mobile developers to do inference efficiently
+ on mobile devices.
+* [TensorFlow Serving](/serving) is an open-source project that can put
+ TensorFlow models in production quickly.
+* The [ecosystem](/ecosystem) contains more projects, including
+ [Magenta](https://magenta.tensorflow.org/), [TFX](/tfx),
+ [Swift for TensorFlow](https://github.com/tensorflow/swift), and more.
+
+## Learn more about machine learning
+
+Recommended resources include:
+
+* [Machine Learning Crash Course](https://developers.google.com/machine-learning/crash-course/),
+ a course from Google that introduces machine learning concepts.
+* [CS 20: Tensorflow for Deep Learning Research](http://web.stanford.edu/class/cs20si/),
+ notes from an intro course from Stanford.
+* [CS231n: Convolutional Neural Networks for Visual Recognition](http://cs231n.stanford.edu/),
+ a course that teaches how convolutional networks work.
+* [Machine Learning Recipes](https://www.youtube.com/watch?v=cKxRvEZd3Mw&list=PLOU2XLYxmsIIuiBfYad6rFYQU_jL2ryal),
+ a video series that introduces basic machine learning concepts with few prerequisites.
+* [Deep Learning with Python](https://www.manning.com/books/deep-learning-with-python),
+ a book by Francois Chollet about the Keras API, as well as an excellent hands on intro to Deep Learning.
+* [Hands-on Machine Learning with Scikit-Learn and TensorFlow](https://github.com/ageron/handson-ml),
+ a book by Aurélien Geron's that is a clear getting-started guide to data science and deep learning.
+* [Deep Learning](https://www.deeplearningbook.org/), a book by Ian Goodfellow et al.
+ that provides a technical dive into learning machine learning.
diff --git a/tensorflow/docs_src/get_started/overfit_and_underfit.md b/tensorflow/docs_src/get_started/overfit_and_underfit.md
new file mode 100644
index 0000000000..e5b5ae7b5a
--- /dev/null
+++ b/tensorflow/docs_src/get_started/overfit_and_underfit.md
@@ -0,0 +1,3 @@
+# Overfitting and Underfitting
+
+[Colab notebook](https://colab.research.google.com/github/tensorflow/models/blob/master/samples/core/get_started/overfit_and_underfit.ipynb)
diff --git a/tensorflow/docs_src/get_started/save_and_restore_models.md b/tensorflow/docs_src/get_started/save_and_restore_models.md
new file mode 100644
index 0000000000..44b3772945
--- /dev/null
+++ b/tensorflow/docs_src/get_started/save_and_restore_models.md
@@ -0,0 +1,3 @@
+# Save and restore Models
+
+[Colab notebook](https://colab.research.google.com/github/tensorflow/models/blob/master/samples/core/get_started/save_and_restore_models.ipynb)
diff --git a/tensorflow/docs_src/install/install_linux.md b/tensorflow/docs_src/install/install_linux.md
index 9baf6870be..41619ca230 100644
--- a/tensorflow/docs_src/install/install_linux.md
+++ b/tensorflow/docs_src/install/install_linux.md
@@ -491,13 +491,7 @@ TensorFlow programs:
If the system outputs an error message instead of a greeting, see [Common
installation problems](#common_installation_problems).
-If you are new to machine learning, we recommend the following:
-
-* [Machine Learning Crash Course](https://developers.google.com/machine-learning/crash-course)
-* @{$get_started/eager}
-
-If you are experienced with machine learning but new to TensorFlow, see
-@{$get_started/eager}.
+To learn more, see [Get Started with TensorFlow](https://www.tensorflow.org/get_started).
## TensorFlow GPU support
diff --git a/tensorflow/docs_src/install/install_mac.md b/tensorflow/docs_src/install/install_mac.md
index 693254f876..eeca389617 100644
--- a/tensorflow/docs_src/install/install_mac.md
+++ b/tensorflow/docs_src/install/install_mac.md
@@ -403,11 +403,7 @@ writing TensorFlow programs:
If the system outputs an error message instead of a greeting, see
[Common installation problems](#common_installation_problems).
-If you are new to machine learning, we recommend the
-[Machine Learning Crash Course](https://developers.google.com/machine-learning/crash-course).
-
-If you are experienced with machine learning but new to TensorFlow, see
-@{$get_started/eager}.
+To learn more, see [Get Started with TensorFlow](https://www.tensorflow.org/get_started).
## Common installation problems
diff --git a/tensorflow/docs_src/install/install_raspbian.md b/tensorflow/docs_src/install/install_raspbian.md
index 2f425162a1..0caab6d335 100644
--- a/tensorflow/docs_src/install/install_raspbian.md
+++ b/tensorflow/docs_src/install/install_raspbian.md
@@ -230,11 +230,7 @@ problems, despite the log message.
If the system outputs an error message instead of a greeting, see [Common
installation problems](#common_installation_problems).
-If you are new to machine learning, we recommend the [Machine Learning Crash
-Course](https://developers.google.com/machine-learning/crash-course).
-
-If you are experienced with machine learning but new to TensorFlow, see
-@{$get_started/eager}.
+To learn more, see [Get Started with TensorFlow](https://www.tensorflow.org/get_started).
## Common installation problems
diff --git a/tensorflow/docs_src/install/install_sources.md b/tensorflow/docs_src/install/install_sources.md
index 70e97cf556..7afcd340aa 100644
--- a/tensorflow/docs_src/install/install_sources.md
+++ b/tensorflow/docs_src/install/install_sources.md
@@ -362,7 +362,7 @@ TensorFlow programs:
Hello, TensorFlow!
-If you are new to TensorFlow, see @{$get_started/eager}.
+To learn more, see [Get Started with TensorFlow](https://www.tensorflow.org/get_started).
If the system outputs an error message instead of a greeting, see [Common
installation problems](#common_installation_problems).
diff --git a/tensorflow/docs_src/install/install_windows.md b/tensorflow/docs_src/install/install_windows.md
index 6c4f5b85ab..7fe94f0bc3 100644
--- a/tensorflow/docs_src/install/install_windows.md
+++ b/tensorflow/docs_src/install/install_windows.md
@@ -157,12 +157,7 @@ TensorFlow programs:
If the system outputs an error message instead of a greeting, see [Common
installation problems](#common_installation_problems).
-If you are new to machine learning, we recommend the
-[Machine Learning Crash Course](https://developers.google.com/machine-learning/crash-course).
-
-If you are experienced with machine learning but new to TensorFlow, see
-@{$get_started/eager}.
-
+To learn more, see [Get Started with TensorFlow](https://www.tensorflow.org/get_started).
## Common installation problems
diff --git a/tensorflow/docs_src/get_started/datasets_quickstart.md b/tensorflow/docs_src/programmers_guide/datasets_for_estimators.md
similarity index 99%
rename from tensorflow/docs_src/get_started/datasets_quickstart.md
rename to tensorflow/docs_src/programmers_guide/datasets_for_estimators.md
index 020e40dd3b..345a31b985 100644
--- a/tensorflow/docs_src/get_started/datasets_quickstart.md
+++ b/tensorflow/docs_src/programmers_guide/datasets_for_estimators.md
@@ -1,4 +1,4 @@
-# Datasets Quick Start
+# Datasets for Estimators
The @{tf.data} module contains a collection of classes that allows you to
easily load data, manipulate it, and pipe it into your model. This document
diff --git a/tensorflow/docs_src/programmers_guide/index.md b/tensorflow/docs_src/programmers_guide/index.md
index 0c2d4afb11..9c58a3b45e 100644
--- a/tensorflow/docs_src/programmers_guide/index.md
+++ b/tensorflow/docs_src/programmers_guide/index.md
@@ -22,6 +22,7 @@ works. The units are as follows:
design yourself.
* @{$feature_columns}, which shows how an Estimator can handle a variety of input
data types without changes to the model.
+* @{$datasets_for_estimators} describes using tf.data with estimators.
* @{$checkpoints}, which explains how to save training progress and resume where
you left off.
diff --git a/tensorflow/docs_src/programmers_guide/leftnav_files b/tensorflow/docs_src/programmers_guide/leftnav_files
index 3bcf864e13..357a2a1cb9 100644
--- a/tensorflow/docs_src/programmers_guide/leftnav_files
+++ b/tensorflow/docs_src/programmers_guide/leftnav_files
@@ -10,6 +10,7 @@ estimators.md: Introduction to Estimators
premade_estimators.md
custom_estimators.md
feature_columns.md
+datasets_for_estimators.md
checkpoints.md
### Accelerators
diff --git a/tensorflow/docs_src/programmers_guide/premade_estimators.md b/tensorflow/docs_src/programmers_guide/premade_estimators.md
index f6dd75eaca..02e2caf64b 100644
--- a/tensorflow/docs_src/programmers_guide/premade_estimators.md
+++ b/tensorflow/docs_src/programmers_guide/premade_estimators.md
@@ -81,7 +81,7 @@ We strongly recommend writing TensorFlow programs with the following APIs:
* @{$programmers_guide/estimators$Estimators}, which represent a complete model.
The Estimator API provides methods to train the model, to judge the model's
accuracy, and to generate predictions.
-* @{$get_started/datasets_quickstart$Datasets}, which build a data input
+* @{$programmers_guide/datasets_for_estimators}, which build a data input
pipeline. The Dataset API has methods to load and manipulate data, and feed
it into your model. The Dataset API meshes well with the Estimators API.
@@ -424,9 +424,7 @@ Now that you've gotten started writing TensorFlow programs, consider the
following material:
* @{$checkpoints$Checkpoints} to learn how to save and restore models.
-* @{$get_started/datasets_quickstart$Datasets} to learn more about importing
- data into your
- model.
+* @{$programmers_guide/datasets_for_estimators} to learn more about importing
+ data into your model.
* @{$custom_estimators$Creating Custom Estimators} to learn how to
write your own Estimator, customized for a particular problem.
-
diff --git a/tensorflow/docs_src/tutorials/index.md b/tensorflow/docs_src/tutorials/index.md
index af01d3eaa1..6bd3a3a897 100644
--- a/tensorflow/docs_src/tutorials/index.md
+++ b/tensorflow/docs_src/tutorials/index.md
@@ -2,9 +2,8 @@
This section contains tutorials demonstrating how to do specific tasks
-in TensorFlow. If you are new to TensorFlow, we recommend reading the
-documents in the "@{$get_started$Get Started}" section before reading
-these tutorials.
+in TensorFlow. If you are new to TensorFlow, we recommend reading
+[Get Started with TensorFlow](/get_started/).
## Images
--
GitLab
From d9e006e80990e54913c25de70a1f8e7db2f22bc8 Mon Sep 17 00:00:00 2001
From: Billy Lamberta
Date: Wed, 20 Jun 2018 10:02:25 -0700
Subject: [PATCH 045/519] Fix eager path in get_started leftnav
PiperOrigin-RevId: 201370156
---
tensorflow/docs_src/get_started/leftnav_files | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tensorflow/docs_src/get_started/leftnav_files b/tensorflow/docs_src/get_started/leftnav_files
index 9a60496cb5..5c400a67f0 100644
--- a/tensorflow/docs_src/get_started/leftnav_files
+++ b/tensorflow/docs_src/get_started/leftnav_files
@@ -7,4 +7,4 @@ save_and_restore_models.md
next_steps.md
### Research and experimentation
-custom_training_walkthrough.md
+eager.md
--
GitLab
From 4e0b1612e0a71b0e14da2bc37c49e3d65744342c Mon Sep 17 00:00:00 2001
From: Mark Daoust
Date: Fri, 22 Jun 2018 15:37:58 -0700
Subject: [PATCH 046/519] Add Install Raspbian to leftnav.
PiperOrigin-RevId: 201752380
---
tensorflow/docs_src/install/leftnav_files | 1 +
1 file changed, 1 insertion(+)
diff --git a/tensorflow/docs_src/install/leftnav_files b/tensorflow/docs_src/install/leftnav_files
index e523e06f67..ace275c0e8 100644
--- a/tensorflow/docs_src/install/leftnav_files
+++ b/tensorflow/docs_src/install/leftnav_files
@@ -4,6 +4,7 @@ index.md
install_linux.md: Ubuntu
install_mac.md: MacOS
install_windows.md: Windows
+install_raspbian.md: Raspbian
install_sources.md: From source
>>>
migration.md
--
GitLab
From 2897538b938dcd6d9c63a97f0870232ac9e4819e Mon Sep 17 00:00:00 2001
From: Mark Daoust
Date: Mon, 25 Jun 2018 12:48:40 -0700
Subject: [PATCH 047/519] Update r1.9 release notes.
- link to new get_started.
- Add keras CuDNN layers.
- Links for gradient boosted estimators.
- Added new contrib-estimators and string-processing.
- Bumped some minor sounding things down from "Major" to "Bugfix+Other"
---
RELEASE.md | 35 +++++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/RELEASE.md b/RELEASE.md
index 510eca5467..bfe0da8739 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -1,18 +1,37 @@
# Release 1.9.0
## Major Features And Improvements
-* Update tf.keras to the Keras 2.1.6 API.
+* New `tf.keras` based [get_started](http://tensorflow.org/versions/r1.9/get_started)
+* Update `tf.keras` to the Keras 2.1.6 API.
+* Added [`tf.keras.layers.CuDNNGRU`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/keras/layers/CuDNNGRU) and [`tf.keras.layers.CuDNNLSTM`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/keras/layers/CuDNNLSTM) layers. [Try it](https://colab.sandbox.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb?linkId=53292082).
+* Adding support of core [feature columns](https://www.tensorflow.org/get_started/feature_columns) and [losses](https://www.tensorflow.org/api_docs/python/tf/losses) to [gradient boosted trees estimators](https://github.com/tensorflow/models/tree/master/official/boosted_trees).
+* The [python interface](https://tensorflow-dot-devsite.googleplex.com/versions/r1.9/api_docs/python/tf/contrib/lite)
+ for the [TFLite Optimizing Converter](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/toco/README.md)
+ has been expanded, and the command line interface (AKA: `toco`, `tflite_convert`) is once again
+ included in the standard `pip` installation.
+* Improved data-loading and text processing with:
+ * [`tf.decode_compressed`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/decode_compressed)
+ * [`tf.string_strip`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/string_strip)
+ * [`tf.strings.regex_full_match`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/strings/regex_full_match)
+* Added experimental support for new pre-made Estimators:
+ * [`tf.contrib.estimator.BaselineEstimator`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/contrib/estimator/BaselineEstimator)
+ * [`tf.contrib.estimator.RNNClassifier`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/contrib/estimator/RNNEstimator)
+ * [`tf.contrib.estimator.RNNEstimator`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/contrib/estimator/RNNClassifier)
+* The [distributions.Bijector](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/contrib/distributions/bijectors/Bijector)
+ API supports broadcasting for Bijectors with new API changes.
+
+## Breaking Chances
+ * If you're opening empty variable scopes; replace `variable_scope('', ...)` by
+ `variable_scope(tf.get_variable_scope(), ...)`.
+
+## Bug Fixes and Other Changes
+
* `tfe.Network` is deprecated. Please inherit from `tf.keras.Model`.
-* Adding support of core feature columns and losses to gradient boosted trees estimators.
-* The distributions.Bijector API supports broadcasting for Bijectors with new API changes. See [here](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/distributions/bijectors/Bijector) for more details.
* Layered variable names have changed in the following conditions:
* Using `tf.keras.layers` with custom variable scopes.
- * Using `tf.layers` in a subclassed `tf.keras.Model` class. See [here](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/layers) for more details
+ * Using `tf.layers` in a subclassed `tf.keras.Model` class. See
+ [here](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/layers) for more details
-## Breaking Chances
- * If you're opening empty variable scopes; replace `variable_scope`('', ...) by `variable_scope`(`tf.get_variable_scope()`, ...).
-
-## Bug Fixes and Other Changes
* `tf.data`:
* `Dataset.from_generator()` now accepts an `args` list, in order to create nested generators.
* `Dataset.list_files()` now produces determinstic results when `shuffle=False` or a `seed` is passed.
--
GitLab
From 56fba15b868145f87109bd5cb155527b0c0640d1 Mon Sep 17 00:00:00 2001
From: Mark Daoust
Date: Mon, 25 Jun 2018 13:16:52 -0700
Subject: [PATCH 048/519] Update RELEASE.md
---
RELEASE.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/RELEASE.md b/RELEASE.md
index bfe0da8739..f6a52a2951 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -1,7 +1,7 @@
# Release 1.9.0
## Major Features And Improvements
-* New `tf.keras` based [get_started](http://tensorflow.org/versions/r1.9/get_started)
+* New `tf.keras` based [get_started](http://tensorflow.org/versions/r1.9/get_started), and [programmers_guide](http://tensorflow.org/versions/r1.9/programmers_guide/keras).
* Update `tf.keras` to the Keras 2.1.6 API.
* Added [`tf.keras.layers.CuDNNGRU`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/keras/layers/CuDNNGRU) and [`tf.keras.layers.CuDNNLSTM`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/keras/layers/CuDNNLSTM) layers. [Try it](https://colab.sandbox.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb?linkId=53292082).
* Adding support of core [feature columns](https://www.tensorflow.org/get_started/feature_columns) and [losses](https://www.tensorflow.org/api_docs/python/tf/losses) to [gradient boosted trees estimators](https://github.com/tensorflow/models/tree/master/official/boosted_trees).
--
GitLab
From ce03a10d70884d2b6d8134b30ad3c5d181877403 Mon Sep 17 00:00:00 2001
From: Mark Daoust
Date: Mon, 25 Jun 2018 13:22:14 -0700
Subject: [PATCH 049/519] Update RELEASE.md
---
RELEASE.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/RELEASE.md b/RELEASE.md
index f6a52a2951..5c79ebec34 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -1,7 +1,8 @@
# Release 1.9.0
## Major Features And Improvements
-* New `tf.keras` based [get_started](http://tensorflow.org/versions/r1.9/get_started), and [programmers_guide](http://tensorflow.org/versions/r1.9/programmers_guide/keras).
+* Updated docs for `tf.keras`: New Keras-based [get started](http://tensorflow.org/versions/r1.9/get_started),
+ and [programmers guide page](http://tensorflow.org/versions/r1.9/programmers_guide/keras).
* Update `tf.keras` to the Keras 2.1.6 API.
* Added [`tf.keras.layers.CuDNNGRU`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/keras/layers/CuDNNGRU) and [`tf.keras.layers.CuDNNLSTM`](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/keras/layers/CuDNNLSTM) layers. [Try it](https://colab.sandbox.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb?linkId=53292082).
* Adding support of core [feature columns](https://www.tensorflow.org/get_started/feature_columns) and [losses](https://www.tensorflow.org/api_docs/python/tf/losses) to [gradient boosted trees estimators](https://github.com/tensorflow/models/tree/master/official/boosted_trees).
--
GitLab
From b0f2eee339a041de4e7837b68a9ff4fc77ca7c4a Mon Sep 17 00:00:00 2001
From: Billy Lamberta
Date: Fri, 22 Jun 2018 17:40:27 -0700
Subject: [PATCH 050/519] Rename programmers_guide/ directory to guide/. Update
references in source files and docs in tensorflow and related projects.
PiperOrigin-RevId: 201766994
---
README.md | 2 +-
RELEASE.md | 6 ++--
tensorflow/contrib/autograph/README.md | 2 +-
tensorflow/contrib/data/__init__.py | 2 +-
tensorflow/contrib/eager/README.md | 2 +-
.../examples/notebooks/3_datasets.ipynb | 6 ++--
.../contrib/eager/python/g3doc/guide.md | 4 +--
tensorflow/contrib/lite/toco/README.md | 2 +-
.../contrib/tpu/python/tpu/tpu_estimator.py | 2 +-
tensorflow/core/protobuf/config.proto | 6 ++--
.../docs_src/api_guides/python/client.md | 2 +-
.../api_guides/python/input_dataset.md | 3 +-
.../api_guides/python/reading_data.md | 8 ++---
tensorflow/docs_src/deploy/distributed.md | 2 +-
tensorflow/docs_src/extend/architecture.md | 5 ++-
tensorflow/docs_src/get_started/_index.yaml | 12 +++----
tensorflow/docs_src/get_started/next_steps.md | 4 +--
.../checkpoints.md | 8 ++---
.../custom_estimators.md | 0
.../{programmers_guide => guide}/datasets.md | 0
.../datasets_for_estimators.md | 8 ++---
.../{programmers_guide => guide}/debugger.md | 0
.../{programmers_guide => guide}/eager.md | 0
.../{programmers_guide => guide}/embedding.md | 0
.../estimators.md | 2 +-
.../{programmers_guide => guide}/faq.md | 0
.../feature_columns.md | 2 +-
.../{programmers_guide => guide}/graph_viz.md | 0
.../{programmers_guide => guide}/graphs.md | 2 +-
.../{programmers_guide => guide}/index.md | 34 +++++++++----------
.../{programmers_guide => guide}/keras.md | 28 +++++++--------
.../leftnav_files | 0
.../low_level_intro.md | 2 +-
.../premade_estimators.md | 8 ++---
.../saved_model.md | 4 +--
.../summaries_and_tensorboard.md | 0
.../tensorboard_histograms.md | 0
.../{programmers_guide => guide}/tensors.md | 4 +--
.../{programmers_guide => guide}/using_gpu.md | 0
.../{programmers_guide => guide}/using_tpu.md | 4 +--
.../{programmers_guide => guide}/variables.md | 0
.../version_compat.md | 0
tensorflow/docs_src/install/install_go.md | 2 +-
tensorflow/docs_src/install/install_java.md | 2 +-
tensorflow/docs_src/tutorials/deep_cnn.md | 2 +-
tensorflow/docs_src/tutorials/layers.md | 2 +-
.../reading_data/fully_connected_reader.py | 2 +-
tensorflow/java/README.md | 5 ++-
.../java/org/tensorflow/package-info.java | 2 +-
tensorflow/python/data/__init__.py | 2 +-
tensorflow/python/data/ops/dataset_ops.py | 14 ++++++++
tensorflow/python/debug/BUILD | 2 +-
tensorflow/python/debug/README.md | 4 +--
tensorflow/python/debug/examples/README.md | 4 +--
tensorflow/python/estimator/keras.py | 2 +-
tensorflow/python/ops/script_ops.py | 2 +-
tensorflow/python/tools/saved_model_cli.py | 4 +--
third_party/examples/eager/spinn/README.md | 2 +-
58 files changed, 119 insertions(+), 110 deletions(-)
rename tensorflow/docs_src/{programmers_guide => guide}/checkpoints.md (96%)
rename tensorflow/docs_src/{programmers_guide => guide}/custom_estimators.md (100%)
rename tensorflow/docs_src/{programmers_guide => guide}/datasets.md (100%)
rename tensorflow/docs_src/{programmers_guide => guide}/datasets_for_estimators.md (97%)
rename tensorflow/docs_src/{programmers_guide => guide}/debugger.md (100%)
rename tensorflow/docs_src/{programmers_guide => guide}/eager.md (100%)
rename tensorflow/docs_src/{programmers_guide => guide}/embedding.md (100%)
rename tensorflow/docs_src/{programmers_guide => guide}/estimators.md (99%)
rename tensorflow/docs_src/{programmers_guide => guide}/faq.md (100%)
rename tensorflow/docs_src/{programmers_guide => guide}/feature_columns.md (99%)
rename tensorflow/docs_src/{programmers_guide => guide}/graph_viz.md (100%)
rename tensorflow/docs_src/{programmers_guide => guide}/graphs.md (99%)
rename tensorflow/docs_src/{programmers_guide => guide}/index.md (72%)
rename tensorflow/docs_src/{programmers_guide => guide}/keras.md (95%)
rename tensorflow/docs_src/{programmers_guide => guide}/leftnav_files (100%)
rename tensorflow/docs_src/{programmers_guide => guide}/low_level_intro.md (99%)
rename tensorflow/docs_src/{programmers_guide => guide}/premade_estimators.md (98%)
rename tensorflow/docs_src/{programmers_guide => guide}/saved_model.md (99%)
rename tensorflow/docs_src/{programmers_guide => guide}/summaries_and_tensorboard.md (100%)
rename tensorflow/docs_src/{programmers_guide => guide}/tensorboard_histograms.md (100%)
rename tensorflow/docs_src/{programmers_guide => guide}/tensors.md (98%)
rename tensorflow/docs_src/{programmers_guide => guide}/using_gpu.md (100%)
rename tensorflow/docs_src/{programmers_guide => guide}/using_tpu.md (98%)
rename tensorflow/docs_src/{programmers_guide => guide}/variables.md (100%)
rename tensorflow/docs_src/{programmers_guide => guide}/version_compat.md (100%)
diff --git a/README.md b/README.md
index 6fb4486d0d..4e4d139bd1 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ data flow graphs. The graph nodes represent mathematical operations, while
the graph edges represent the multidimensional data arrays (tensors) that flow
between them. This flexible architecture enables you to deploy computation to one
or more CPUs or GPUs in a desktop, server, or mobile device without rewriting
-code. TensorFlow also includes [TensorBoard](https://www.tensorflow.org/programmers_guide/summaries_and_tensorboard), a data visualization toolkit.
+code. TensorFlow also includes [TensorBoard](https://www.tensorflow.org/guide/summaries_and_tensorboard), a data visualization toolkit.
TensorFlow was originally developed by researchers and engineers
working on the Google Brain team within Google's Machine Intelligence Research
diff --git a/RELEASE.md b/RELEASE.md
index 510eca5467..5fec61af7e 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -467,7 +467,7 @@ answered questions, and were part of inspiring discussions.
## Major Features And Improvements
* `tf.keras` is now part of the core TensorFlow API.
-* [`tf.data`](http://tensorflow.org/programmers_guide/datasets) is now part of
+* [`tf.data`](http://tensorflow.org/guide/datasets) is now part of
the core TensorFlow API.
* The API is now subject to backwards compatibility guarantees.
@@ -495,7 +495,7 @@ answered questions, and were part of inspiring discussions.
* TensorFlow Debugger (tfdbg):
* Add `eval` command to allow evaluation of arbitrary Python/numpy expressions
in tfdbg command-line interface. See
- [Debugging TensorFlow Programs](https://www.tensorflow.org/programmers_guide/debugger)
+ [Debugging TensorFlow Programs](https://www.tensorflow.org/guide/debugger)
for more details.
* Usability improvement: The frequently used tensor filter `has_inf_or_nan` is
now added to `Session` wrappers and hooks by default. So there is no need
@@ -782,7 +782,7 @@ answered questions, and were part of inspiring discussions.
* Support client-provided ClusterSpec's and propagate them to all workers to enable the creation of dynamic TensorFlow clusters.
* TensorFlow C library now available for Windows.
* We released a new open-source version of TensorBoard.
-* [`SavedModel CLI`](https://www.tensorflow.org/versions/master/programmers_guide/saved_model_cli) tool available to inspect and execute MetaGraph in SavedModel
+* [`SavedModel CLI`](https://www.tensorflow.org/versions/master/guide/saved_model_cli) tool available to inspect and execute MetaGraph in SavedModel
* Android releases of TensorFlow are now pushed to jcenter for easier
integration into apps. See
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/android/README.md
diff --git a/tensorflow/contrib/autograph/README.md b/tensorflow/contrib/autograph/README.md
index 674859bed4..47b1d4a99a 100644
--- a/tensorflow/contrib/autograph/README.md
+++ b/tensorflow/contrib/autograph/README.md
@@ -4,7 +4,7 @@ IMPORTANT: AutoGraph is alpha software, and under active development. Expect rou
AutoGraph is a Python to TensorFlow compiler.
-With AutoGraph, you can write [Eager style](https://www.tensorflow.org/programmers_guide/eager) code in a concise manner, and run it as a TensorFlow graph. AutoGraph uses source code transformation and partial evaluation to generate Python code that builds an equivalent TensorFlow subgraph. The result is code that behaves like ops and can be freely combined with other TensorFlow ops.
+With AutoGraph, you can write [Eager style](https://www.tensorflow.org/guide/eager) code in a concise manner, and run it as a TensorFlow graph. AutoGraph uses source code transformation and partial evaluation to generate Python code that builds an equivalent TensorFlow subgraph. The result is code that behaves like ops and can be freely combined with other TensorFlow ops.
For example, this Python function:
diff --git a/tensorflow/contrib/data/__init__.py b/tensorflow/contrib/data/__init__.py
index 9c6a13333e..3510e7b1ad 100644
--- a/tensorflow/contrib/data/__init__.py
+++ b/tensorflow/contrib/data/__init__.py
@@ -20,7 +20,7 @@ be used in conjunction with the @{tf.data.Dataset} API. Note that the
guarantees as `tf.data`, but we will provide deprecation advice in advance of
removing existing functionality.
-See the @{$datasets$Importing Data} Programmer's Guide for an overview.
+See @{$guide/datasets$Importing Data} for an overview.
@@Counter
@@CheckpointInputPipelineHook
diff --git a/tensorflow/contrib/eager/README.md b/tensorflow/contrib/eager/README.md
index 4384431e7b..86d203452e 100644
--- a/tensorflow/contrib/eager/README.md
+++ b/tensorflow/contrib/eager/README.md
@@ -44,7 +44,7 @@ Installation instructions at https://www.tensorflow.org/install/
For an introduction to eager execution in TensorFlow, see:
-- [User Guide](https://www.tensorflow.org/programmers_guide/eager) ([source](../../docs_src/programmers_guide/eager.md))
+- [User Guide](https://www.tensorflow.org/guide/eager) ([source](../../docs_src/guide/eager.md))
- Notebook: [Basic Usage](python/examples/notebooks/1_basics.ipynb)
- Notebook: [Gradients](python/examples/notebooks/2_gradients.ipynb)
- Notebook: [Importing Data](python/examples/notebooks/3_datasets.ipynb)
diff --git a/tensorflow/contrib/eager/python/examples/notebooks/3_datasets.ipynb b/tensorflow/contrib/eager/python/examples/notebooks/3_datasets.ipynb
index bfcc7feb07..d268cbcd91 100644
--- a/tensorflow/contrib/eager/python/examples/notebooks/3_datasets.ipynb
+++ b/tensorflow/contrib/eager/python/examples/notebooks/3_datasets.ipynb
@@ -9,7 +9,7 @@
"source": [
"# Eager Execution Tutorial: Importing Data\n",
"\n",
- "This notebook demonstrates the use of the [`tf.data.Dataset` API](https://www.tensorflow.org/programmers_guide/datasets) to build pipelines to feed data to your program. It covers:\n",
+ "This notebook demonstrates the use of the [`tf.data.Dataset` API](https://www.tensorflow.org/guide/datasets) to build pipelines to feed data to your program. It covers:\n",
"\n",
"* Creating a `Dataset`.\n",
"* Iteration over a `Dataset` with eager execution enabled.\n",
@@ -18,7 +18,7 @@
"\n",
"If you're familiar with TensorFlow graphs, the API for constructing the `Dataset` object remains exactly the same when eager execution is enabled, but the process of iterating over elements of the dataset is slightly simpler.\n",
"You can use Python iteration over the `tf.data.Dataset` object and do not need to explicitly create an `tf.data.Iterator` object.\n",
- "As a result, the discussion on iterators in the [Programmer's Guide](https://www.tensorflow.org/programmers_guide/datasets) is not relevant when eager execution is enabled."
+ "As a result, the discussion on iterators in the [TensorFlow Guide](https://www.tensorflow.org/guide/datasets) is not relevant when eager execution is enabled."
]
},
{
@@ -63,7 +63,7 @@
"source": [
"# Step 1: Create a source `Dataset`\n",
"\n",
- "Create a _source_ dataset using one of the factory functions like [`Dataset.from_tensors`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#from_tensors), [`Dataset.from_tensor_slices`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#from_tensor_slices) or using objects that read from files like [`TextLineDataset`](https://www.tensorflow.org/api_docs/python/tf/data/TextLineDataset) or [`TFRecordDataset`](https://www.tensorflow.org/api_docs/python/tf/data/TFRecordDataset). See the [Programmer's Guide](https://www.google.com/url?sa=D\u0026q=https%3A%2F%2Fwww.tensorflow.org%2Fprogrammers_guide%2Fdatasets%23reading_input_data) for more information."
+ "Create a _source_ dataset using one of the factory functions like [`Dataset.from_tensors`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#from_tensors), [`Dataset.from_tensor_slices`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#from_tensor_slices) or using objects that read from files like [`TextLineDataset`](https://www.tensorflow.org/api_docs/python/tf/data/TextLineDataset) or [`TFRecordDataset`](https://www.tensorflow.org/api_docs/python/tf/data/TFRecordDataset). See the [TensorFlow Guide](https://www.tensorflow.org/guide/datasets#reading_input_data) for more information."
]
},
{
diff --git a/tensorflow/contrib/eager/python/g3doc/guide.md b/tensorflow/contrib/eager/python/g3doc/guide.md
index 2d2aba6908..23f33d0230 100644
--- a/tensorflow/contrib/eager/python/g3doc/guide.md
+++ b/tensorflow/contrib/eager/python/g3doc/guide.md
@@ -4,8 +4,8 @@ Eager execution is a feature that makes TensorFlow execute operations
immediately: concrete values are returned, instead of creating a computational
graph that is executed later.
-A user guide is available: https://www.tensorflow.org/programmers_guide/eager
-([source file](../../../../docs_src/programmers_guide/eager.md))
+A user guide is available: https://www.tensorflow.org/guide/eager
+([source file](../../../../docs_src/guide/eager.md))
We welcome feedback through [GitHub issues](https://github.com/tensorflow/tensorflow/labels/comp:eager).
diff --git a/tensorflow/contrib/lite/toco/README.md b/tensorflow/contrib/lite/toco/README.md
index 522e260ad2..ee83c7a6e3 100644
--- a/tensorflow/contrib/lite/toco/README.md
+++ b/tensorflow/contrib/lite/toco/README.md
@@ -17,7 +17,7 @@ Usage information is given in these documents:
Once an application developer has a trained TensorFlow model, TOCO will accept
that model and generate a TensorFlow Lite
[FlatBuffer](https://google.github.io/flatbuffers/) file. TOCO currently supports
-[SavedModels](https://www.tensorflow.org/programmers_guide/saved_model#using_savedmodel_with_estimators)
+[SavedModels](https://www.tensorflow.org/guide/saved_model#using_savedmodel_with_estimators)
and frozen graphs (models generated via
[freeze_graph.py](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py)).
The TensorFlow Lite FlatBuffer file can be shipped to client devices, generally
diff --git a/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py b/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py
index 7c770912b4..c57acd0a2d 100644
--- a/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py
+++ b/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py
@@ -1103,7 +1103,7 @@ class _InputPipeline(object):
err_msg = ('Input pipeline contains one or more QueueRunners. '
'It could be slow and not scalable. Please consider '
'converting your input pipeline to use `tf.data` instead (see '
- 'https://www.tensorflow.org/programmers_guide/datasets for '
+ 'https://www.tensorflow.org/guide/datasets for '
'instructions.')
if _WRAP_INPUT_FN_INTO_WHILE_LOOP:
raise RuntimeError(err_msg)
diff --git a/tensorflow/core/protobuf/config.proto b/tensorflow/core/protobuf/config.proto
index 9a48f43a63..d83215d5c2 100644
--- a/tensorflow/core/protobuf/config.proto
+++ b/tensorflow/core/protobuf/config.proto
@@ -147,7 +147,7 @@ message GPUOptions {
// Everything inside experimental is subject to change and is not subject
// to API stability guarantees in
- // https://www.tensorflow.org/programmers_guide/version_compat.
+ // https://www.tensorflow.org/guide/version_compat.
Experimental experimental = 9;
};
@@ -381,7 +381,7 @@ message ConfigProto {
// Everything inside Experimental is subject to change and is not subject
// to API stability guarantees in
- // https://www.tensorflow.org/programmers_guide/version_compat.
+ // https://www.tensorflow.org/guide/version_compat.
message Experimental {
// Task name for group resolution.
string collective_group_leader = 1;
@@ -426,7 +426,7 @@ message RunOptions {
// Everything inside Experimental is subject to change and is not subject
// to API stability guarantees in
- // https://www.tensorflow.org/programmers_guide/version_compat.
+ // https://www.tensorflow.org/guide/version_compat.
message Experimental {
// If non-zero, declares that this graph is going to use collective
// ops and must synchronize step_ids with any other graph with this
diff --git a/tensorflow/docs_src/api_guides/python/client.md b/tensorflow/docs_src/api_guides/python/client.md
index eef23696db..27fc8610bf 100644
--- a/tensorflow/docs_src/api_guides/python/client.md
+++ b/tensorflow/docs_src/api_guides/python/client.md
@@ -3,7 +3,7 @@
This library contains classes for launching graphs and executing operations.
-@{$programmers_guide/low_level_intro$This guide} has examples of how a graph
+@{$guide/low_level_intro$This guide} has examples of how a graph
is launched in a @{tf.Session}.
## Session management
diff --git a/tensorflow/docs_src/api_guides/python/input_dataset.md b/tensorflow/docs_src/api_guides/python/input_dataset.md
index a6e2fc48e0..a6612d1bf7 100644
--- a/tensorflow/docs_src/api_guides/python/input_dataset.md
+++ b/tensorflow/docs_src/api_guides/python/input_dataset.md
@@ -2,8 +2,7 @@
[TOC]
@{tf.data.Dataset} allows you to build complex input pipelines. See the
-@{$datasets$programmer's guide} for an in-depth explanation of how to use this
-API.
+@{$guide/datasets} for an in-depth explanation of how to use this API.
## Reader classes
diff --git a/tensorflow/docs_src/api_guides/python/reading_data.md b/tensorflow/docs_src/api_guides/python/reading_data.md
index 5bbbfd3216..d7d0904ae2 100644
--- a/tensorflow/docs_src/api_guides/python/reading_data.md
+++ b/tensorflow/docs_src/api_guides/python/reading_data.md
@@ -16,8 +16,8 @@ There are four methods of getting data into a TensorFlow program:
## `tf.data` API
-See the @{$datasets$programmer's guide} for an in-depth explanation of
-@{tf.data.Dataset}. The `tf.data` API enables you to extract and preprocess data
+See the @{$guide/datasets} for an in-depth explanation of @{tf.data.Dataset}.
+The `tf.data` API enables you to extract and preprocess data
from different input/file formats, and apply transformations such as batching,
shuffling, and mapping functions over the dataset. This is an improved version
of the old input methods---feeding and `QueueRunner`---which are described
@@ -511,8 +511,8 @@ You can have the train and eval in the same graph in the same process, and share
their trained variables or layers. See @{$variables$the shared variables tutorial}.
To support the single-graph approach
-@{$programmers_guide/datasets$`tf.data`} also supplies
-@{$programmers_guide/datasets#creating_an_iterator$advanced iterator types} that
+@{$guide/datasets$`tf.data`} also supplies
+@{$guide/datasets#creating_an_iterator$advanced iterator types} that
that allow the user to change the input pipeline without rebuilding the graph or
session.
diff --git a/tensorflow/docs_src/deploy/distributed.md b/tensorflow/docs_src/deploy/distributed.md
index d7ed6b1deb..8e2c818e39 100644
--- a/tensorflow/docs_src/deploy/distributed.md
+++ b/tensorflow/docs_src/deploy/distributed.md
@@ -2,7 +2,7 @@
This document shows how to create a cluster of TensorFlow servers, and how to
distribute a computation graph across that cluster. We assume that you are
-familiar with the @{$programmers_guide/low_level_intro$basic concepts} of
+familiar with the @{$guide/low_level_intro$basic concepts} of
writing low level TensorFlow programs.
## Hello distributed TensorFlow!
diff --git a/tensorflow/docs_src/extend/architecture.md b/tensorflow/docs_src/extend/architecture.md
index c8f522a03a..84435a57f2 100644
--- a/tensorflow/docs_src/extend/architecture.md
+++ b/tensorflow/docs_src/extend/architecture.md
@@ -7,9 +7,8 @@ learning models and system-level optimizations.
This document describes the system architecture that makes this
combination of scale and flexibility possible. It assumes that you have basic familiarity
with TensorFlow programming concepts such as the computation graph, operations,
-and sessions. See @{$programmers_guide/low_level_intro$this document}
-for an introduction to these topics. Some familiarity
-with @{$distributed$distributed TensorFlow}
+and sessions. See @{$guide/low_level_intro$this document} for an introduction to
+these topics. Some familiarity with @{$distributed$distributed TensorFlow}
will also be helpful.
This document is for developers who want to extend TensorFlow in some way not
diff --git a/tensorflow/docs_src/get_started/_index.yaml b/tensorflow/docs_src/get_started/_index.yaml
index af255a482d..277fc852fb 100644
--- a/tensorflow/docs_src/get_started/_index.yaml
+++ b/tensorflow/docs_src/get_started/_index.yaml
@@ -74,7 +74,7 @@ landing_page:
The high-level Keras API provides building blocks to create and
train deep learning models. Start with these beginner-friendly
notebook examples, then read the
- TensorFlow Keras guide.
+ TensorFlow Keras guide.
- Basic classification
@@ -85,7 +85,7 @@ landing_page:
- classname: tfo-landing-row-item-code-block
@@ -123,7 +123,7 @@ landing_page:
Eager execution provides an imperative, define-by-run interface for advanced operations. Write custom layers, forward passes, and training loops with auto‑differentiation. Start with
- these notebooks, then read the eager execution guide.
+ these notebooks, then read the eager execution guide.
-
@@ -165,7 +165,7 @@ landing_page:
- custom_html: >
@@ -177,7 +177,7 @@ landing_page:
Estimators can train large models on multiple machines in a
production environment. Try the examples below and read the
- Estimators guide.
+ Estimators guide.
- How to build a simple text classifier with TF-Hub
@@ -186,7 +186,7 @@ landing_page:
diff --git a/tensorflow/docs_src/get_started/next_steps.md b/tensorflow/docs_src/get_started/next_steps.md
index 79c0ef3346..6318a39c6c 100644
--- a/tensorflow/docs_src/get_started/next_steps.md
+++ b/tensorflow/docs_src/get_started/next_steps.md
@@ -2,9 +2,9 @@
## Learn more about TensorFlow
-* The [TensorFlow Guide](/programmers_guide) includes usage guides for the
+* The [TensorFlow Guide](/guide) includes usage guides for the
high-level APIs, as well as advanced TensorFlow operations.
-* [Premade Estimators](/programmers_guide/premade_estimators) are designed to
+* [Premade Estimators](/guide/premade_estimators) are designed to
get results out of the box. Use TensorFlow without building your own models.
* [TensorFlow.js](https://js.tensorflow.org/) allows web developers to train and
deploy ML models in the browser and using Node.js.
diff --git a/tensorflow/docs_src/programmers_guide/checkpoints.md b/tensorflow/docs_src/guide/checkpoints.md
similarity index 96%
rename from tensorflow/docs_src/programmers_guide/checkpoints.md
rename to tensorflow/docs_src/guide/checkpoints.md
index 8dfd91e3c8..dfb2626b86 100644
--- a/tensorflow/docs_src/programmers_guide/checkpoints.md
+++ b/tensorflow/docs_src/guide/checkpoints.md
@@ -8,9 +8,8 @@ Estimators. TensorFlow provides two model formats:
* SavedModel, which is a format independent of the code that created
the model.
-This document focuses on checkpoints. For details on SavedModel, see the
-@{$saved_model$Saving and Restoring} chapter of the
-*TensorFlow Programmer's Guide*.
+This document focuses on checkpoints. For details on `SavedModel`, see the
+@{$saved_model$Saving and Restoring} guide.
## Sample code
@@ -232,8 +231,7 @@ This separation will keep your checkpoints recoverable.
Checkpoints provide an easy automatic mechanism for saving and restoring
models created by Estimators.
-See the @{$saved_model$Saving and Restoring}
-chapter of the *TensorFlow Programmer's Guide* for details on:
+See the @{$saved_model$Saving and Restoring} guide for details about:
* Saving and restoring models using low-level TensorFlow APIs.
* Exporting and importing models in the SavedModel format, which is a
diff --git a/tensorflow/docs_src/programmers_guide/custom_estimators.md b/tensorflow/docs_src/guide/custom_estimators.md
similarity index 100%
rename from tensorflow/docs_src/programmers_guide/custom_estimators.md
rename to tensorflow/docs_src/guide/custom_estimators.md
diff --git a/tensorflow/docs_src/programmers_guide/datasets.md b/tensorflow/docs_src/guide/datasets.md
similarity index 100%
rename from tensorflow/docs_src/programmers_guide/datasets.md
rename to tensorflow/docs_src/guide/datasets.md
diff --git a/tensorflow/docs_src/programmers_guide/datasets_for_estimators.md b/tensorflow/docs_src/guide/datasets_for_estimators.md
similarity index 97%
rename from tensorflow/docs_src/programmers_guide/datasets_for_estimators.md
rename to tensorflow/docs_src/guide/datasets_for_estimators.md
index 345a31b985..b04af78cd8 100644
--- a/tensorflow/docs_src/programmers_guide/datasets_for_estimators.md
+++ b/tensorflow/docs_src/guide/datasets_for_estimators.md
@@ -91,8 +91,8 @@ print(mnist_ds)
```
This will print the following line, showing the
-@{$programmers_guide/tensors#shapes$shapes} and
-@{$programmers_guide/tensors#data_types$types} of the items in
+@{$guide/tensors#shapes$shapes} and
+@{$guide/tensors#data_types$types} of the items in
the dataset. Note that a `Dataset` does not know how many items it contains.
``` None
@@ -128,7 +128,7 @@ print(dataset)
Here we see that when a `Dataset` contains structured elements, the `shapes`
and `types` of the `Dataset` take on the same structure. This dataset contains
-dictionaries of @{$programmers_guide/tensors#rank$scalars}, all of type
+dictionaries of @{$guide/tensors#rank$scalars}, all of type
`tf.float64`.
The first line of the iris `train_input_fn` uses the same functionality, but
@@ -382,6 +382,6 @@ Estimator. Consider the following documents next:
* The @{$low_level_intro#datasets$Low Level Introduction}, which demonstrates
how to experiment directly with `tf.data.Datasets` using TensorFlow's low
level APIs.
-* @{$programmers_guide/datasets} which goes into great detail about additional
+* @{$guide/datasets} which goes into great detail about additional
functionality of `Datasets`.
diff --git a/tensorflow/docs_src/programmers_guide/debugger.md b/tensorflow/docs_src/guide/debugger.md
similarity index 100%
rename from tensorflow/docs_src/programmers_guide/debugger.md
rename to tensorflow/docs_src/guide/debugger.md
diff --git a/tensorflow/docs_src/programmers_guide/eager.md b/tensorflow/docs_src/guide/eager.md
similarity index 100%
rename from tensorflow/docs_src/programmers_guide/eager.md
rename to tensorflow/docs_src/guide/eager.md
diff --git a/tensorflow/docs_src/programmers_guide/embedding.md b/tensorflow/docs_src/guide/embedding.md
similarity index 100%
rename from tensorflow/docs_src/programmers_guide/embedding.md
rename to tensorflow/docs_src/guide/embedding.md
diff --git a/tensorflow/docs_src/programmers_guide/estimators.md b/tensorflow/docs_src/guide/estimators.md
similarity index 99%
rename from tensorflow/docs_src/programmers_guide/estimators.md
rename to tensorflow/docs_src/guide/estimators.md
index b13b47184d..78b30c3040 100644
--- a/tensorflow/docs_src/programmers_guide/estimators.md
+++ b/tensorflow/docs_src/guide/estimators.md
@@ -81,7 +81,7 @@ of the following four steps:
... # manipulate dataset, extracting the feature dict and the label
return feature_dict, label
- (See @{$programmers_guide/datasets} for full details.)
+ (See @{$guide/datasets} for full details.)
2. **Define the feature columns.** Each @{tf.feature_column}
identifies a feature name, its type, and any input pre-processing.
diff --git a/tensorflow/docs_src/programmers_guide/faq.md b/tensorflow/docs_src/guide/faq.md
similarity index 100%
rename from tensorflow/docs_src/programmers_guide/faq.md
rename to tensorflow/docs_src/guide/faq.md
diff --git a/tensorflow/docs_src/programmers_guide/feature_columns.md b/tensorflow/docs_src/guide/feature_columns.md
similarity index 99%
rename from tensorflow/docs_src/programmers_guide/feature_columns.md
rename to tensorflow/docs_src/guide/feature_columns.md
index 90f5c53a17..1013ec910c 100644
--- a/tensorflow/docs_src/programmers_guide/feature_columns.md
+++ b/tensorflow/docs_src/guide/feature_columns.md
@@ -534,7 +534,7 @@ embedding_column = tf.feature_column.embedding_column(
dimension=embedding_dimensions)
```
-@{$programmers_guide/embedding$Embeddings} is a significant topic within machine
+@{$guide/embedding$Embeddings} is a significant topic within machine
learning. This information was just to get you started using them as feature
columns.
diff --git a/tensorflow/docs_src/programmers_guide/graph_viz.md b/tensorflow/docs_src/guide/graph_viz.md
similarity index 100%
rename from tensorflow/docs_src/programmers_guide/graph_viz.md
rename to tensorflow/docs_src/guide/graph_viz.md
diff --git a/tensorflow/docs_src/programmers_guide/graphs.md b/tensorflow/docs_src/guide/graphs.md
similarity index 99%
rename from tensorflow/docs_src/programmers_guide/graphs.md
rename to tensorflow/docs_src/guide/graphs.md
index f0dd8def17..e6246ef148 100644
--- a/tensorflow/docs_src/programmers_guide/graphs.md
+++ b/tensorflow/docs_src/guide/graphs.md
@@ -93,7 +93,7 @@ to all API functions in the same context. For example:
stored value. The @{tf.Variable} object also has methods such as
@{tf.Variable.assign$`assign`} and @{tf.Variable.assign_add$`assign_add`} that
create @{tf.Operation} objects that, when executed, update the stored value.
- (See @{$programmers_guide/variables} for more information about variables.)
+ (See @{$guide/variables} for more information about variables.)
* Calling @{tf.train.Optimizer.minimize} will add operations and tensors to the
default graph that calculates gradients, and return a @{tf.Operation} that,
diff --git a/tensorflow/docs_src/programmers_guide/index.md b/tensorflow/docs_src/guide/index.md
similarity index 72%
rename from tensorflow/docs_src/programmers_guide/index.md
rename to tensorflow/docs_src/guide/index.md
index 9c58a3b45e..eefdb9ceae 100644
--- a/tensorflow/docs_src/programmers_guide/index.md
+++ b/tensorflow/docs_src/guide/index.md
@@ -1,17 +1,17 @@
-# Programmer's Guide
+# TensorFlow Guide
The documents in this unit dive into the details of how TensorFlow
works. The units are as follows:
## High Level APIs
- * @{$programmers_guide/keras}, TensorFlow's high-level API for building and
+ * @{$guide/keras}, TensorFlow's high-level API for building and
training deep learning models.
- * @{$programmers_guide/eager}, an API for writing TensorFlow code
+ * @{$guide/eager}, an API for writing TensorFlow code
imperatively, like you would use Numpy.
- * @{$programmers_guide/estimators}, a high-level API that provides
+ * @{$guide/estimators}, a high-level API that provides
fully-packaged models ready for large-scale training and production.
- * @{$programmers_guide/datasets}, easy input pipelines to bring your data into
+ * @{$guide/datasets}, easy input pipelines to bring your data into
your TensorFlow program.
## Estimators
@@ -34,13 +34,13 @@ works. The units are as follows:
## Low Level APIs
- * @{$programmers_guide/low_level_intro}, which introduces the
+ * @{$guide/low_level_intro}, which introduces the
basics of how you can use TensorFlow outside of the high Level APIs.
- * @{$programmers_guide/tensors}, which explains how to create,
+ * @{$guide/tensors}, which explains how to create,
manipulate, and access Tensors--the fundamental object in TensorFlow.
- * @{$programmers_guide/variables}, which details how
+ * @{$guide/variables}, which details how
to represent shared, persistent state in your program.
- * @{$programmers_guide/graphs}, which explains:
+ * @{$guide/graphs}, which explains:
* dataflow graphs, which are TensorFlow's representation of computations
as dependencies between operations.
* sessions, which are TensorFlow's mechanism for running dataflow graphs
@@ -50,19 +50,19 @@ works. The units are as follows:
such as Estimators or Keras, the high-level API creates and manages
graphs and sessions for you, but understanding graphs and sessions
can still be helpful.
- * @{$programmers_guide/saved_model}, which
+ * @{$guide/saved_model}, which
explains how to save and restore variables and models.
## ML Concepts
- * @{$programmers_guide/embedding}, which introduces the concept
+ * @{$guide/embedding}, which introduces the concept
of embeddings, provides a simple example of training an embedding in
TensorFlow, and explains how to view embeddings with the TensorBoard
Embedding Projector.
## Debugging
- * @{$programmers_guide/debugger}, which
+ * @{$guide/debugger}, which
explains how to use the TensorFlow debugger (tfdbg).
## TensorBoard
@@ -70,17 +70,17 @@ works. The units are as follows:
TensorBoard is a utility to visualize different aspects of machine learning.
The following guides explain how to use TensorBoard:
- * @{$programmers_guide/summaries_and_tensorboard},
+ * @{$guide/summaries_and_tensorboard},
which introduces TensorBoard.
- * @{$programmers_guide/graph_viz}, which
+ * @{$guide/graph_viz}, which
explains how to visualize the computational graph.
- * @{$programmers_guide/tensorboard_histograms} which demonstrates the how to
+ * @{$guide/tensorboard_histograms} which demonstrates the how to
use TensorBoard's histogram dashboard.
## Misc
- * @{$programmers_guide/version_compat},
+ * @{$guide/version_compat},
which explains backward compatibility guarantees and non-guarantees.
- * @{$programmers_guide/faq}, which contains frequently asked
+ * @{$guide/faq}, which contains frequently asked
questions about TensorFlow.
diff --git a/tensorflow/docs_src/programmers_guide/keras.md b/tensorflow/docs_src/guide/keras.md
similarity index 95%
rename from tensorflow/docs_src/programmers_guide/keras.md
rename to tensorflow/docs_src/guide/keras.md
index c6aca7ebf4..83172dab7f 100644
--- a/tensorflow/docs_src/programmers_guide/keras.md
+++ b/tensorflow/docs_src/guide/keras.md
@@ -19,7 +19,7 @@ fast prototyping, advanced research, and production, with three key advantages:
[Keras API specification](https://keras.io){:.external}. This is a high-level
API to build and train models that includes first-class support for
TensorFlow-specific functionality, such as [eager execution](#eager_execution),
-`tf.data` pipelines, and [Estimators](/programmers_guide/estimators).
+`tf.data` pipelines, and [Estimators](./estimators.md).
`tf.keras` makes TensorFlow easier to use without sacrificing flexibility and
performance.
@@ -35,8 +35,8 @@ from tensorflow import keras
* The `tf.keras` version in the latest TensorFlow release might not be the same
as the latest `keras` version from PyPI. Check `tf.keras.__version__`.
* When [saving a model's weights](#weights_only), `tf.keras` defaults to the
- [checkpoint format](/get_started/checkpoints). Pass `save_format='h5'` to use
- HDF5.
+ [checkpoint format](../get_started/checkpoints.md). Pass `save_format='h5'` to
+ use HDF5.
## Build a simple model
@@ -179,7 +179,7 @@ model.fit(data, labels, epochs=10, batch_size=32,
### Input tf.data datasets
-Use the [Datasets API](/programmers_guide/datasets) to scale to large datasets
+Use the [Datasets API](./datasets.md) to scale to large datasets
or multi-device training. Pass a `tf.data.Dataset` instance to the `fit`
method:
@@ -285,7 +285,7 @@ your own forward pass. Create layers in the `__init__` method and set them as
attributes of the class instance. Define the forward pass in the `call` method.
Model subclassing is particularly useful when
-[eager execution](/programmers_guide/eager) is enabled since the forward pass
+[eager execution](./eager.md) is enabled since the forward pass
can be written imperatively.
Key Point: Use the right API for the job. While model subclassing offers
@@ -410,7 +410,7 @@ during training. You can write your own custom callback, or use the built-in
* `tf.keras.callbacks.EarlyStopping`: Interrupt training when validation
performance has stopped improving.
* `tf.keras.callbacks.TensorBoard`: Monitor the model's behavior using
- [TensorBoard](/programmers_guide/summaries_and_tensorboard).
+ [TensorBoard](./summaries_and_tensorboard.md).
To use a `tf.keras.callbacks.Callback`, pass it to the model's `fit` method:
@@ -442,8 +442,8 @@ model.load_weights('my_model')
```
By default, this saves the model's weights in the
-[TensorFlow checkpoint](/get_started/checkpoints) file format. Weights can also
-be saved to the Keras HDF5 format (the default for the multi-backend
+[TensorFlow checkpoint](../get_started/checkpoints.md) file format. Weights can
+also be saved to the Keras HDF5 format (the default for the multi-backend
implementation of Keras):
```python
@@ -509,7 +509,7 @@ model = keras.models.load_model('my_model.h5')
## Eager execution
-[Eager execution](/programmers_guide/eager) is an imperative programming
+[Eager execution](./eager.md) is an imperative programming
environment that evaluates operations immediately. This is not required for
Keras, but is supported by `tf.keras` and useful for inspecting your program and
debugging.
@@ -520,7 +520,7 @@ especially benefits *model subclassing* and building *custom layers*—the APIs
that require you to write the forward pass as code (instead of the APIs that
create models by assembling existing layers).
-See the [eager execution guide](/programmers_guide/eager#build_a_model) for
+See the [eager execution guide](./eager.md#build_a_model) for
examples of using Keras models with custom training loops and `tf.GradientTape`.
@@ -528,14 +528,14 @@ examples of using Keras models with custom training loops and `tf.GradientTape`.
### Estimators
-The [Estimators](/programmers_guide/estimators) API is used for training models
+The [Estimators](./estimators.md) API is used for training models
for distributed environments. This targets industry use cases such as
distributed training on large datasets that can export a model for production.
A `tf.keras.Model` can be trained with the `tf.estimator` API by converting the
model to an `tf.estimator.Estimator` object with
`tf.keras.estimator.model_to_estimator`. See
-[Creating Estimators from Keras models](/programmers_guide/estimators#creating_estimators_from_keras_models).
+[Creating Estimators from Keras models](./estimators.md#creating_estimators_from_keras_models).
```python
model = keras.Sequential([layers.Dense(10,activation='softmax'),
@@ -548,8 +548,8 @@ model.compile(optimizer=tf.train.RMSPropOptimizer(0.001),
estimator = keras.estimator.model_to_estimator(model)
```
-Note: Enable [eager execution](/programmers_guide/eager) for debugging
-[Estimator input functions](/programmers_guide/premade_estimators#create_input_functions)
+Note: Enable [eager execution](./eager.md) for debugging
+[Estimator input functions](./premade_estimators.md#create_input_functions)
and inspecting data.
### Multiple GPUs
diff --git a/tensorflow/docs_src/programmers_guide/leftnav_files b/tensorflow/docs_src/guide/leftnav_files
similarity index 100%
rename from tensorflow/docs_src/programmers_guide/leftnav_files
rename to tensorflow/docs_src/guide/leftnav_files
diff --git a/tensorflow/docs_src/programmers_guide/low_level_intro.md b/tensorflow/docs_src/guide/low_level_intro.md
similarity index 99%
rename from tensorflow/docs_src/programmers_guide/low_level_intro.md
rename to tensorflow/docs_src/guide/low_level_intro.md
index 478e2bb70b..665a5568b4 100644
--- a/tensorflow/docs_src/programmers_guide/low_level_intro.md
+++ b/tensorflow/docs_src/guide/low_level_intro.md
@@ -303,7 +303,7 @@ while True:
break
```
-For more details on Datasets and Iterators see: @{$programmers_guide/datasets}.
+For more details on Datasets and Iterators see: @{$guide/datasets}.
## Layers
diff --git a/tensorflow/docs_src/programmers_guide/premade_estimators.md b/tensorflow/docs_src/guide/premade_estimators.md
similarity index 98%
rename from tensorflow/docs_src/programmers_guide/premade_estimators.md
rename to tensorflow/docs_src/guide/premade_estimators.md
index 02e2caf64b..3e910c1fe2 100644
--- a/tensorflow/docs_src/programmers_guide/premade_estimators.md
+++ b/tensorflow/docs_src/guide/premade_estimators.md
@@ -78,10 +78,10 @@ provides a programming stack consisting of multiple API layers:
We strongly recommend writing TensorFlow programs with the following APIs:
-* @{$programmers_guide/estimators$Estimators}, which represent a complete model.
+* @{$guide/estimators$Estimators}, which represent a complete model.
The Estimator API provides methods to train the model, to judge the model's
accuracy, and to generate predictions.
-* @{$programmers_guide/datasets_for_estimators}, which build a data input
+* @{$guide/datasets_for_estimators}, which build a data input
pipeline. The Dataset API has methods to load and manipulate data, and feed
it into your model. The Dataset API meshes well with the Estimators API.
@@ -173,7 +173,7 @@ example is an Iris Versicolor.
An Estimator is TensorFlow's high-level representation of a complete model. It
handles the details of initialization, logging, saving and restoring, and many
other features so you can concentrate on your model. For more details see
-@{$programmers_guide/estimators}.
+@{$guide/estimators}.
An Estimator is any class derived from @{tf.estimator.Estimator}. TensorFlow
provides a collection of
@@ -424,7 +424,7 @@ Now that you've gotten started writing TensorFlow programs, consider the
following material:
* @{$checkpoints$Checkpoints} to learn how to save and restore models.
-* @{$programmers_guide/datasets_for_estimators} to learn more about importing
+* @{$guide/datasets_for_estimators} to learn more about importing
data into your model.
* @{$custom_estimators$Creating Custom Estimators} to learn how to
write your own Estimator, customized for a particular problem.
diff --git a/tensorflow/docs_src/programmers_guide/saved_model.md b/tensorflow/docs_src/guide/saved_model.md
similarity index 99%
rename from tensorflow/docs_src/programmers_guide/saved_model.md
rename to tensorflow/docs_src/guide/saved_model.md
index c6ef87c54a..27ef7bb0da 100644
--- a/tensorflow/docs_src/programmers_guide/saved_model.md
+++ b/tensorflow/docs_src/guide/saved_model.md
@@ -3,7 +3,7 @@
The @{tf.train.Saver} class provides methods to save and restore models. The
@{tf.saved_model.simple_save} function is an easy way to build a
@{tf.saved_model$saved model} suitable for serving.
-[Estimators](@{$programmers_guide/estimators}) automatically save and restore
+[Estimators](@{$guide/estimators}) automatically save and restore
variables in the `model_dir`.
## Save and restore variables
@@ -299,7 +299,7 @@ following:
added attributes with defaults don't cause older model consumers to fail
loading models regenerated with newer training binaries.
-See [compatibility guidance](https://www.tensorflow.org/programmers_guide/version_compat)
+See [compatibility guidance](./version_compat.md)
for more information.
### Loading a SavedModel in Python
diff --git a/tensorflow/docs_src/programmers_guide/summaries_and_tensorboard.md b/tensorflow/docs_src/guide/summaries_and_tensorboard.md
similarity index 100%
rename from tensorflow/docs_src/programmers_guide/summaries_and_tensorboard.md
rename to tensorflow/docs_src/guide/summaries_and_tensorboard.md
diff --git a/tensorflow/docs_src/programmers_guide/tensorboard_histograms.md b/tensorflow/docs_src/guide/tensorboard_histograms.md
similarity index 100%
rename from tensorflow/docs_src/programmers_guide/tensorboard_histograms.md
rename to tensorflow/docs_src/guide/tensorboard_histograms.md
diff --git a/tensorflow/docs_src/programmers_guide/tensors.md b/tensorflow/docs_src/guide/tensors.md
similarity index 98%
rename from tensorflow/docs_src/programmers_guide/tensors.md
rename to tensorflow/docs_src/guide/tensors.md
index 1248c3cabe..7227260f1a 100644
--- a/tensorflow/docs_src/programmers_guide/tensors.md
+++ b/tensorflow/docs_src/guide/tensors.md
@@ -26,7 +26,7 @@ some cases it's only possible to find the shape of a tensor at graph execution
time.
Some types of tensors are special, and these will be covered in other
-units of the Programmer's guide. The main ones are:
+units of the TensorFlow guide. The main ones are:
* `tf.Variable`
* `tf.constant`
@@ -230,7 +230,7 @@ yet_another = tf.reshape(matrixAlt, [13, 2, -1]) # ERROR!
## Data types
In addition to dimensionality, Tensors have a data type. Refer to the
-`tf.DataType` page in the programmer's guide for a full list of the data types.
+`tf.DType` page for a complete list of the data types.
It is not possible to have a `tf.Tensor` with more than one data type. It is
possible, however, to serialize arbitrary data structures as `string`s and store
diff --git a/tensorflow/docs_src/programmers_guide/using_gpu.md b/tensorflow/docs_src/guide/using_gpu.md
similarity index 100%
rename from tensorflow/docs_src/programmers_guide/using_gpu.md
rename to tensorflow/docs_src/guide/using_gpu.md
diff --git a/tensorflow/docs_src/programmers_guide/using_tpu.md b/tensorflow/docs_src/guide/using_tpu.md
similarity index 98%
rename from tensorflow/docs_src/programmers_guide/using_tpu.md
rename to tensorflow/docs_src/guide/using_tpu.md
index 44aabf0557..41d80d9d60 100644
--- a/tensorflow/docs_src/programmers_guide/using_tpu.md
+++ b/tensorflow/docs_src/guide/using_tpu.md
@@ -171,7 +171,7 @@ This section details the changes you must make to the model function
During regular usage TensorFlow attempts to determine the shapes of each
`tf.Tensor` during graph construction. During execution any unknown shape
dimensions are determined dynamically,
-see @{$programmers_guide/tensors#shape$Tensor Shapes} for more details.
+see @{$guide/tensors#shape$Tensor Shapes} for more details.
To run on Cloud TPUs TensorFlow models are compiled using @{$xla$XLA}.
XLA uses a similar system for determining shapes at compile time. XLA requires
@@ -195,7 +195,7 @@ TPU.
Build your evaluation metrics dictionary in a stand-alone `metric_fn`.
-
+
Evaluation metrics are an essential part of training a model. These are fully
supported on Cloud TPUs, but with a slightly different syntax.
diff --git a/tensorflow/docs_src/programmers_guide/variables.md b/tensorflow/docs_src/guide/variables.md
similarity index 100%
rename from tensorflow/docs_src/programmers_guide/variables.md
rename to tensorflow/docs_src/guide/variables.md
diff --git a/tensorflow/docs_src/programmers_guide/version_compat.md b/tensorflow/docs_src/guide/version_compat.md
similarity index 100%
rename from tensorflow/docs_src/programmers_guide/version_compat.md
rename to tensorflow/docs_src/guide/version_compat.md
diff --git a/tensorflow/docs_src/install/install_go.md b/tensorflow/docs_src/install/install_go.md
index 1c03dd223e..5451e1b319 100644
--- a/tensorflow/docs_src/install/install_go.md
+++ b/tensorflow/docs_src/install/install_go.md
@@ -6,7 +6,7 @@ a Go application. This guide explains how to install and set up the
[TensorFlow Go package](https://godoc.org/github.com/tensorflow/tensorflow/tensorflow/go).
Warning: The TensorFlow Go API is *not* covered by the TensorFlow
-[API stability guarantees](https://www.tensorflow.org/programmers_guide/version_semantics).
+[API stability guarantees](../guide/version_semantics.md).
## Supported Platforms
diff --git a/tensorflow/docs_src/install/install_java.md b/tensorflow/docs_src/install/install_java.md
index c73e2f4281..ad3544b595 100644
--- a/tensorflow/docs_src/install/install_java.md
+++ b/tensorflow/docs_src/install/install_java.md
@@ -7,7 +7,7 @@ Java application. This guide explains how to install
and use it in a Java application.
Warning: The TensorFlow Java API is *not* covered by the TensorFlow
-[API stability guarantees](https://www.tensorflow.org/programmers_guide/version_semantics).
+[API stability guarantees](../guide/version_semantics.md).
## Supported Platforms
diff --git a/tensorflow/docs_src/tutorials/deep_cnn.md b/tensorflow/docs_src/tutorials/deep_cnn.md
index 6a4c9a9b07..44a32d9d1d 100644
--- a/tensorflow/docs_src/tutorials/deep_cnn.md
+++ b/tensorflow/docs_src/tutorials/deep_cnn.md
@@ -268,7 +268,7 @@ in `cifar10_input.py`.
`cifar10_train.py` periodically @{tf.train.Saver$saves}
all model parameters in
-@{$programmers_guide/saved_model$checkpoint files}
+@{$guide/saved_model$checkpoint files}
but it does *not* evaluate the model. The checkpoint file
will be used by `cifar10_eval.py` to measure the predictive
performance (see [Evaluating a Model](#evaluating-a-model) below).
diff --git a/tensorflow/docs_src/tutorials/layers.md b/tensorflow/docs_src/tutorials/layers.md
index 0f17899dae..212e337637 100644
--- a/tensorflow/docs_src/tutorials/layers.md
+++ b/tensorflow/docs_src/tutorials/layers.md
@@ -627,7 +627,7 @@ operation earlier when we generated the probabilities in `cnn_model_fn`.
> argument, TensorFlow will assign a default name. A couple easy ways to
> discover the names applied to operations are to visualize your graph on
> @{$graph_viz$TensorBoard}) or to enable the
-> @{$programmers_guide/debugger$TensorFlow Debugger (tfdbg)}.
+> @{$guide/debugger$TensorFlow Debugger (tfdbg)}.
Next, we create the `LoggingTensorHook`, passing `tensors_to_log` to the
`tensors` argument. We set `every_n_iter=50`, which specifies that probabilities
diff --git a/tensorflow/examples/how_tos/reading_data/fully_connected_reader.py b/tensorflow/examples/how_tos/reading_data/fully_connected_reader.py
index 307eede5c0..7402247448 100644
--- a/tensorflow/examples/how_tos/reading_data/fully_connected_reader.py
+++ b/tensorflow/examples/how_tos/reading_data/fully_connected_reader.py
@@ -17,7 +17,7 @@
This version is like fully_connected_feed.py but uses data converted
to a TFRecords file containing tf.train.Example protocol buffers.
See:
-https://www.tensorflow.org/programmers_guide/reading_data#reading_from_files
+https://www.tensorflow.org/guide/reading_data#reading_from_files
for context.
YOU MUST run convert_to_records before running this (but you only need to
diff --git a/tensorflow/java/README.md b/tensorflow/java/README.md
index 2f1ce253b2..c7382ff231 100644
--- a/tensorflow/java/README.md
+++ b/tensorflow/java/README.md
@@ -1,7 +1,7 @@
# TensorFlow for Java
> *WARNING*: The TensorFlow Java API is not currently covered by the TensorFlow
-> [API stability guarantees](https://www.tensorflow.org/programmers_guide/version_semantics).
+> [API stability guarantees](https://www.tensorflow.org/guide/version_semantics).
>
> For using TensorFlow on Android refer instead to
> [contrib/android](https://www.tensorflow.org/code/tensorflow/contrib/android),
@@ -23,8 +23,7 @@ native libraries will need to be built from source.
2. Setup the environment to build TensorFlow from source code
([Linux](https://www.tensorflow.org/install/install_sources#PrepareLinux)
- or [Mac OS
- X](https://www.tensorflow.org/install/install_sources#PrepareMac)).
+ or [macOS](https://www.tensorflow.org/install/install_sources#PrepareMac)).
If you'd like to skip reading those details and do not care about GPU
support, try the following:
diff --git a/tensorflow/java/src/main/java/org/tensorflow/package-info.java b/tensorflow/java/src/main/java/org/tensorflow/package-info.java
index 521c5c610c..f353ee3145 100644
--- a/tensorflow/java/src/main/java/org/tensorflow/package-info.java
+++ b/tensorflow/java/src/main/java/org/tensorflow/package-info.java
@@ -17,7 +17,7 @@ limitations under the License.
* Defines classes to build, save, load and execute TensorFlow models.
*
* WARNING: The API is currently experimental and is not covered by TensorFlow API stability
+ * href="https://www.tensorflow.org/guide/version_semantics">API stability
* guarantees. See README.md for installation
* instructions.
diff --git a/tensorflow/python/data/__init__.py b/tensorflow/python/data/__init__.py
index 7efe0948e7..3b9bf2469e 100644
--- a/tensorflow/python/data/__init__.py
+++ b/tensorflow/python/data/__init__.py
@@ -14,7 +14,7 @@
# ==============================================================================
"""`tf.data.Dataset` API for input pipelines.
-See the @{$datasets$Importing Data} Programmer's Guide for an overview.
+See @{$guide/datasets$Importing Data} for an overview.
"""
from __future__ import absolute_import
diff --git a/tensorflow/python/data/ops/dataset_ops.py b/tensorflow/python/data/ops/dataset_ops.py
index 6f9b12b123..0e020d86d0 100644
--- a/tensorflow/python/data/ops/dataset_ops.py
+++ b/tensorflow/python/data/ops/dataset_ops.py
@@ -212,6 +212,13 @@ class Dataset(object):
def from_tensors(tensors):
"""Creates a `Dataset` with a single element, comprising the given tensors.
+ Note that if `tensors` contains a NumPy array, and eager execution is not
+ enabled, the values will be embedded in the graph as one or more
+ @{tf.constant} operations. For large datasets (> 1 GB), this can waste
+ memory and run into byte limits of graph serialization. If tensors contains
+ one or more large NumPy arrays, consider the alternative described in
+ @{$guide/datasets#consuming_numpy_arrays$this guide}.
+
Args:
tensors: A nested structure of tensors.
@@ -224,6 +231,13 @@ class Dataset(object):
def from_tensor_slices(tensors):
"""Creates a `Dataset` whose elements are slices of the given tensors.
+ Note that if `tensors` contains a NumPy array, and eager execution is not
+ enabled, the values will be embedded in the graph as one or more
+ @{tf.constant} operations. For large datasets (> 1 GB), this can waste
+ memory and run into byte limits of graph serialization. If tensors contains
+ one or more large NumPy arrays, consider the alternative described in
+ @{$guide/datasets#consuming_numpy_arrays$this guide}.
+
Args:
tensors: A nested structure of tensors, each having the same size in the
0th dimension.
diff --git a/tensorflow/python/debug/BUILD b/tensorflow/python/debug/BUILD
index 09062abd74..2d261f9be7 100644
--- a/tensorflow/python/debug/BUILD
+++ b/tensorflow/python/debug/BUILD
@@ -5,7 +5,7 @@
#
# ":debug_py": Public Python methods and classes of tfdbg.
# For API documentation, see https://www.tensorflow.org/api_docs/python/tfdbg
-# For a user interface walkthrough, see https://www.tensorflow.org/programmers_guide/debugger
+# For a user interface walkthrough, see https://www.tensorflow.org/guide/debugger
# ":grpc_debug_server": Server interface for grpc:// debug URLs.
package(
diff --git a/tensorflow/python/debug/README.md b/tensorflow/python/debug/README.md
index 269bbb19bd..9c16af4d79 100644
--- a/tensorflow/python/debug/README.md
+++ b/tensorflow/python/debug/README.md
@@ -28,7 +28,7 @@ models:
* Easy access through session wrappers
* Easy integration with common high-level APIs, such as
- [TensorFlow Estimators](https://www.tensorflow.org/programmers_guide/estimators) and
+ [TensorFlow Estimators](https://www.tensorflow.org/guide/estimators) and
[Keras](https://keras.io/)
* Inspection of runtime tensor values and node connections
* Conditional breaking after runs that generate tensors satisfying given
@@ -43,7 +43,7 @@ models:
## How to use TFDBG?
-* For a walkthrough of TFDBG command-line interface, see https://www.tensorflow.org/programmers_guide/debugger.
+* For a walkthrough of TFDBG command-line interface, see https://www.tensorflow.org/guide/debugger.
* For information on the web GUI of TFDBG (TensorBoard Debugger Plugin), see
[this README](https://github.com/tensorflow/tensorboard/blob/master/tensorboard/plugins/debugger/README.md).
* For programmatic use of the API of TFDBG, see https://www.tensorflow.org/api_docs/python/tfdbg.
diff --git a/tensorflow/python/debug/examples/README.md b/tensorflow/python/debug/examples/README.md
index cb4d484092..3b431e04dc 100644
--- a/tensorflow/python/debug/examples/README.md
+++ b/tensorflow/python/debug/examples/README.md
@@ -3,7 +3,7 @@ Hi, there!
The documentation of **TensorFlow Debugger (tfdbg)** has moved.
See the source version at
-[this new location](../../../docs_src/programmers_guide/debugger.md).
+[this new location](../../../docs_src/guide/debugger.md).
See the public website version at
-[https://www.tensorflow.org/programmers_guide/debugger](https://www.tensorflow.org/programmers_guide/debugger).
+[https://www.tensorflow.org/guide/debugger](https://www.tensorflow.org/guide/debugger).
diff --git a/tensorflow/python/estimator/keras.py b/tensorflow/python/estimator/keras.py
index 2f439f765e..6856b8b5a9 100644
--- a/tensorflow/python/estimator/keras.py
+++ b/tensorflow/python/estimator/keras.py
@@ -455,7 +455,7 @@ def model_to_estimator(keras_model=None,
"""Constructs an `Estimator` instance from given keras model.
For usage example, please see
- @{$programmers_guide/estimators$creating_estimators_from_keras_models}.
+ @{$guide/estimators$creating_estimators_from_keras_models}.
Args:
keras_model: A compiled Keras model object. This argument is mutually
diff --git a/tensorflow/python/ops/script_ops.py b/tensorflow/python/ops/script_ops.py
index 16c73213d5..f8df9b2c78 100644
--- a/tensorflow/python/ops/script_ops.py
+++ b/tensorflow/python/ops/script_ops.py
@@ -267,7 +267,7 @@ def eager_py_func(func, inp, Tout, name=None):
or print statements as desired, and wrap those functions in
`tf.contrib.eager.py_func`.
- For more information on eager execution, see @{$programmers_guide/eager}.
+ For more information on eager execution, see @{$guide/eager}.
`tf.contrib.eager.py_func` is similar in spirit to @{tf.py_func}, but unlike
the latter, the former lets you use TensorFlow operations in the wrapped
diff --git a/tensorflow/python/tools/saved_model_cli.py b/tensorflow/python/tools/saved_model_cli.py
index 5b9d25d449..38fed5335e 100644
--- a/tensorflow/python/tools/saved_model_cli.py
+++ b/tensorflow/python/tools/saved_model_cli.py
@@ -15,7 +15,7 @@
"""Command-line interface to inspect and execute a graph in a SavedModel.
For detailed usages and examples, please refer to:
-https://www.tensorflow.org/programmers_guide/saved_model_cli
+https://www.tensorflow.org/guide/saved_model_cli
"""
@@ -720,7 +720,7 @@ def create_parser():
'\'input4_key=[{"id":[26],"weights":[0.5, 0.5]}]\' \\\n'
' --outdir=/out\n\n'
'For more information about input file format, please see:\n'
- 'https://www.tensorflow.org/programmers_guide/saved_model_cli\n')
+ 'https://www.tensorflow.org/guide/saved_model_cli\n')
parser_run = subparsers.add_parser(
'run', description=run_msg, formatter_class=argparse.RawTextHelpFormatter)
parser_run.add_argument(
diff --git a/third_party/examples/eager/spinn/README.md b/third_party/examples/eager/spinn/README.md
index fbb1fde837..e2fd8009a0 100644
--- a/third_party/examples/eager/spinn/README.md
+++ b/third_party/examples/eager/spinn/README.md
@@ -22,7 +22,7 @@ Other eager execution examples can be found under [tensorflow/contrib/eager/pyth
- [`data.py`](../../../../tensorflow/contrib/eager/python/examples/spinn/data.py): Pipeline for loading and preprocessing the
[SNLI](https://nlp.stanford.edu/projects/snli/) data and
[GloVe](https://nlp.stanford.edu/projects/glove/) word embedding, written
- using the [`tf.data`](https://www.tensorflow.org/programmers_guide/datasets)
+ using the [`tf.data`](https://www.tensorflow.org/guide/datasets)
API.
- [`spinn.py`](./spinn.py): Model definition and training routines.
This example illustrates how one might perform the following actions with
--
GitLab
From ab60fbc1fcfc600b800ad12c9f76cfccc4fb7087 Mon Sep 17 00:00:00 2001
From: Pete Warden
Date: Tue, 26 Jun 2018 09:32:12 -0700
Subject: [PATCH 051/519] Fix for RPi OpenBLAS compile issues, by pinning to
known good version
---
.../ci_build/install/install_pi_python3_toolchain.sh | 8 ++++++++
tensorflow/tools/ci_build/pi/build_raspberry_pi.sh | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/tensorflow/tools/ci_build/install/install_pi_python3_toolchain.sh b/tensorflow/tools/ci_build/install/install_pi_python3_toolchain.sh
index 9d8e3df3b5..4afb2f1534 100755
--- a/tensorflow/tools/ci_build/install/install_pi_python3_toolchain.sh
+++ b/tensorflow/tools/ci_build/install/install_pi_python3_toolchain.sh
@@ -27,3 +27,11 @@ curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
apt-get update
rm -rf /usr/local/bin/bazel
apt-get install -y bazel python3 python3-numpy python3-dev python3-pip
+
+# We're using Ubuntu 14.04 as our base image because that's needed by the Pi
+# cross-compilation chain, but that doesn't have built-in Python 3.5 support, so
+# install from a separate repository.
+apt-get install -y software-properties-common
+add-apt-repository ppa:fkrull/deadsnakes
+apt-get update
+apt-get install -y python3.5 python3.5-dev
diff --git a/tensorflow/tools/ci_build/pi/build_raspberry_pi.sh b/tensorflow/tools/ci_build/pi/build_raspberry_pi.sh
index 4d1a30601e..5eff3e415d 100755
--- a/tensorflow/tools/ci_build/pi/build_raspberry_pi.sh
+++ b/tensorflow/tools/ci_build/pi/build_raspberry_pi.sh
@@ -65,6 +65,10 @@ OPENBLAS_SRC_PATH=/tmp/openblas_src/
sudo rm -rf ${OPENBLAS_SRC_PATH}
git clone https://github.com/xianyi/OpenBLAS ${OPENBLAS_SRC_PATH}
cd ${OPENBLAS_SRC_PATH}
+# The commit after this introduced Fortran compile issues. In theory they should
+# be solvable using NOFORTRAN=1 on the make command, but my initial tries didn't
+# work, so pinning to the last know good version.
+git checkout 5a6a2bed9aff0ba8a18651d5514d029c8cae336a
# If this path is changed, you'll also need to update
# cxx_builtin_include_directory in third_party/toolchains/cpus/arm/CROSSTOOL.tpl
OPENBLAS_INSTALL_PATH=/tmp/openblas_install/
--
GitLab
From fe374d31f38ba7fa84284b58d28c55dc0087f2b3 Mon Sep 17 00:00:00 2001
From: Pete Warden
Date: Tue, 26 Jun 2018 09:36:22 -0700
Subject: [PATCH 052/519] Removed Python 3.5 updates for RPi
---
.../ci_build/install/install_pi_python3_toolchain.sh | 8 --------
1 file changed, 8 deletions(-)
diff --git a/tensorflow/tools/ci_build/install/install_pi_python3_toolchain.sh b/tensorflow/tools/ci_build/install/install_pi_python3_toolchain.sh
index 4afb2f1534..9d8e3df3b5 100755
--- a/tensorflow/tools/ci_build/install/install_pi_python3_toolchain.sh
+++ b/tensorflow/tools/ci_build/install/install_pi_python3_toolchain.sh
@@ -27,11 +27,3 @@ curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
apt-get update
rm -rf /usr/local/bin/bazel
apt-get install -y bazel python3 python3-numpy python3-dev python3-pip
-
-# We're using Ubuntu 14.04 as our base image because that's needed by the Pi
-# cross-compilation chain, but that doesn't have built-in Python 3.5 support, so
-# install from a separate repository.
-apt-get install -y software-properties-common
-add-apt-repository ppa:fkrull/deadsnakes
-apt-get update
-apt-get install -y python3.5 python3.5-dev
--
GitLab
From 8025ac34099ed1b38c3cf0c0f84244496b42fedb Mon Sep 17 00:00:00 2001
From: Michael Case
Date: Tue, 26 Jun 2018 13:05:25 -0700
Subject: [PATCH 053/519] Moving StatusOr from XLA to stream_executor.
PiperOrigin-RevId: 202179928
---
tensorflow/compiler/xla/BUILD | 17 +-
tensorflow/compiler/xla/service/gpu/BUILD | 1 +
.../xla/service/gpu/stream_executor_util.h | 1 +
tensorflow/compiler/xla/statusor.h | 286 +----------------
tensorflow/stream_executor/BUILD | 2 -
.../xla => stream_executor/lib}/statusor.cc | 8 +-
tensorflow/stream_executor/lib/statusor.h | 290 +++++++++++++++++-
.../lib}/statusor_internals.h | 15 +-
.../lib}/statusor_test.cc | 11 +-
9 files changed, 310 insertions(+), 321 deletions(-)
rename tensorflow/{compiler/xla => stream_executor/lib}/statusor.cc (89%)
rename tensorflow/{compiler/xla => stream_executor/lib}/statusor_internals.h (94%)
rename tensorflow/{compiler/xla => stream_executor/lib}/statusor_test.cc (99%)
diff --git a/tensorflow/compiler/xla/BUILD b/tensorflow/compiler/xla/BUILD
index c6deb959a5..afa8ce730b 100644
--- a/tensorflow/compiler/xla/BUILD
+++ b/tensorflow/compiler/xla/BUILD
@@ -143,30 +143,15 @@ cc_library(
cc_library(
name = "statusor",
- srcs = ["statusor.cc"],
hdrs = [
"statusor.h",
- "statusor_internals.h",
],
visibility = ["//visibility:public"],
deps = [
":status",
"//tensorflow/core:lib",
"//tensorflow/core:lib_internal",
- ],
-)
-
-tf_cc_test(
- name = "statusor_test",
- size = "small",
- srcs = ["statusor_test.cc"],
- deps = [
- ":statusor",
- ":test",
- ":types",
- "//tensorflow/core:lib",
- "//tensorflow/core:test",
- "//tensorflow/core:test_main",
+ "//tensorflow/stream_executor",
],
)
diff --git a/tensorflow/compiler/xla/service/gpu/BUILD b/tensorflow/compiler/xla/service/gpu/BUILD
index 68297ad4ae..fe597bfb45 100644
--- a/tensorflow/compiler/xla/service/gpu/BUILD
+++ b/tensorflow/compiler/xla/service/gpu/BUILD
@@ -727,6 +727,7 @@ cc_library(
hdrs = ["stream_executor_util.h"],
deps = [
"//tensorflow/compiler/xla:shape_util",
+ "//tensorflow/compiler/xla:statusor",
"//tensorflow/compiler/xla:xla_data_proto",
"//tensorflow/core:stream_executor_no_cuda",
],
diff --git a/tensorflow/compiler/xla/service/gpu/stream_executor_util.h b/tensorflow/compiler/xla/service/gpu/stream_executor_util.h
index 8218f4fd11..39a6a38d00 100644
--- a/tensorflow/compiler/xla/service/gpu/stream_executor_util.h
+++ b/tensorflow/compiler/xla/service/gpu/stream_executor_util.h
@@ -16,6 +16,7 @@ limitations under the License.
#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_GPU_STREAM_EXECUTOR_UTIL_H_
#define TENSORFLOW_COMPILER_XLA_SERVICE_GPU_STREAM_EXECUTOR_UTIL_H_
+#include "tensorflow/compiler/xla/statusor.h"
#include "tensorflow/compiler/xla/xla_data.pb.h"
#include "tensorflow/core/platform/stream_executor_no_cuda.h"
diff --git a/tensorflow/compiler/xla/statusor.h b/tensorflow/compiler/xla/statusor.h
index 0e1387c939..a32e2ad985 100644
--- a/tensorflow/compiler/xla/statusor.h
+++ b/tensorflow/compiler/xla/statusor.h
@@ -12,297 +12,17 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
-
-// StatusOr is the union of a Status object and a T object. StatusOr models
-// the concept of an object that is either a value, or an error Status
-// explaining why such a value is not present. To this end, StatusOr does not
-// allow its Status value to be Status::OK.
-//
-// The primary use-case for StatusOr is as the return value of a
-// function which may fail.
-//
-// Example client usage for a StatusOr, where T is not a pointer:
-//
-// StatusOr result = DoBigCalculationThatCouldFail();
-// if (result.ok()) {
-// float answer = result.ValueOrDie();
-// printf("Big calculation yielded: %f", answer);
-// } else {
-// LOG(ERROR) << result.status();
-// }
-//
-// Example client usage for a StatusOr:
-//
-// StatusOr result = FooFactory::MakeNewFoo(arg);
-// if (result.ok()) {
-// std::unique_ptr foo(result.ValueOrDie());
-// foo->DoSomethingCool();
-// } else {
-// LOG(ERROR) << result.status();
-// }
-//
-// Example client usage for a StatusOr>:
-//
-// StatusOr> result = FooFactory::MakeNewFoo(arg);
-// if (result.ok()) {
-// std::unique_ptr foo = std::move(result.ValueOrDie());
-// foo->DoSomethingCool();
-// } else {
-// LOG(ERROR) << result.status();
-// }
-//
-// Example factory implementation returning StatusOr:
-//
-// StatusOr FooFactory::MakeNewFoo(int arg) {
-// if (arg <= 0) {
-// return tensorflow::InvalidArgument("Arg must be positive");
-// } else {
-// return new Foo(arg);
-// }
-// }
-//
-// Note that the assignment operators require that destroying the currently
-// stored value cannot invalidate the argument; in other words, the argument
-// cannot be an alias for the current value, or anything owned by the current
-// value.
#ifndef TENSORFLOW_COMPILER_XLA_STATUSOR_H_
#define TENSORFLOW_COMPILER_XLA_STATUSOR_H_
#include "tensorflow/compiler/xla/status.h"
-#include "tensorflow/compiler/xla/statusor_internals.h"
-#include "tensorflow/core/platform/macros.h"
+#include "tensorflow/stream_executor/lib/statusor.h"
namespace xla {
-#if defined(__clang__)
-// Only clang supports warn_unused_result as a type annotation.
-template
-class TF_MUST_USE_RESULT StatusOr;
-#endif
-
-template
-class StatusOr : private internal_statusor::StatusOrData,
- private internal_statusor::TraitsBase<
- std::is_copy_constructible::value,
- std::is_move_constructible::value> {
- template
- friend class StatusOr;
-
- typedef internal_statusor::StatusOrData Base;
-
- public:
- typedef T element_type;
-
- // Constructs a new StatusOr with Status::UNKNOWN status. This is marked
- // 'explicit' to try to catch cases like 'return {};', where people think
- // StatusOr> will be initialized with an empty vector,
- // instead of a Status::UNKNOWN status.
- explicit StatusOr();
-
- // StatusOr will be copy constructible/assignable if T is copy
- // constructible.
- StatusOr(const StatusOr&) = default;
- StatusOr& operator=(const StatusOr&) = default;
-
- // StatusOr will be move constructible/assignable if T is move
- // constructible.
- StatusOr(StatusOr&&) = default;
- StatusOr& operator=(StatusOr&&) = default;
-
- // Conversion copy/move constructor, T must be convertible from U.
- template ::value>::type* = nullptr>
- StatusOr(const StatusOr& other);
- template ::value>::type* = nullptr>
- StatusOr(StatusOr&& other);
-
- // Conversion copy/move assignment operator, T must be convertible from U.
- template ::value>::type* = nullptr>
- StatusOr& operator=(const StatusOr& other);
- template ::value>::type* = nullptr>
- StatusOr& operator=(StatusOr&& other);
-
- // Constructs a new StatusOr with the given value. After calling this
- // constructor, calls to ValueOrDie() will succeed, and calls to status() will
- // return OK.
- //
- // NOTE: Not explicit - we want to use StatusOr as a return type
- // so it is convenient and sensible to be able to do 'return T()'
- // when the return type is StatusOr.
- //
- // REQUIRES: T is copy constructible.
- StatusOr(const T& value);
-
- // Constructs a new StatusOr with the given non-ok status. After calling
- // this constructor, calls to ValueOrDie() will CHECK-fail.
- //
- // NOTE: Not explicit - we want to use StatusOr as a return
- // value, so it is convenient and sensible to be able to do 'return
- // Status()' when the return type is StatusOr.
- //
- // REQUIRES: !status.ok(). This requirement is DCHECKed.
- // In optimized builds, passing Status::OK() here will have the effect
- // of passing tensorflow::error::INTERNAL as a fallback.
- StatusOr(const Status& status);
- StatusOr& operator=(const Status& status);
-
- // TODO(b/62186997): Add operator=(T) overloads.
-
- // Similar to the `const T&` overload.
- //
- // REQUIRES: T is move constructible.
- StatusOr(T&& value);
-
- // RValue versions of the operations declared above.
- StatusOr(Status&& status);
- StatusOr& operator=(Status&& status);
-
- // Returns this->status().ok()
- bool ok() const { return this->status_.ok(); }
-
- // Returns a reference to our status. If this contains a T, then
- // returns Status::OK().
- const Status& status() const &;
- Status status() &&;
-
- // Returns a reference to our current value, or CHECK-fails if !this->ok().
- //
- // Note: for value types that are cheap to copy, prefer simple code:
- //
- // T value = statusor.ValueOrDie();
- //
- // Otherwise, if the value type is expensive to copy, but can be left
- // in the StatusOr, simply assign to a reference:
- //
- // T& value = statusor.ValueOrDie(); // or `const T&`
- //
- // Otherwise, if the value type supports an efficient move, it can be
- // used as follows:
- //
- // T value = std::move(statusor).ValueOrDie();
- //
- // The std::move on statusor instead of on the whole expression enables
- // warnings about possible uses of the statusor object after the move.
- // C++ style guide waiver for ref-qualified overloads granted in cl/143176389
- // See go/ref-qualifiers for more details on such overloads.
- const T& ValueOrDie() const &;
- T& ValueOrDie() &;
- const T&& ValueOrDie() const &&;
- T&& ValueOrDie() &&;
-
- T ConsumeValueOrDie() { return std::move(ValueOrDie()); }
-
- // Ignores any errors. This method does nothing except potentially suppress
- // complaints from any tools that are checking that errors are not dropped on
- // the floor.
- void IgnoreError() const;
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// Implementation details for StatusOr
-
-template
-StatusOr::StatusOr() : Base(Status(tensorflow::error::UNKNOWN, "")) {}
-
-template
-StatusOr::StatusOr(const T& value) : Base(value) {}
-
-template
-StatusOr::StatusOr(const Status& status) : Base(status) {}
-
-template
-StatusOr& StatusOr::operator=(const Status& status) {
- this->Assign(status);
- return *this;
-}
-
-template
-StatusOr::StatusOr(T&& value) : Base(std::move(value)) {}
-
-template
-StatusOr::StatusOr(Status&& status) : Base(std::move(status)) {}
-
-template
-StatusOr& StatusOr::operator=(Status&& status) {
- this->Assign(std::move(status));
- return *this;
-}
-
-template
-template ::value>::type*>
-inline StatusOr::StatusOr(const StatusOr& other)
- : Base(static_cast::Base&>(other)) {}
-
-template
-template ::value>::type*>
-inline StatusOr& StatusOr::operator=(const StatusOr& other) {
- if (other.ok())
- this->Assign(other.ValueOrDie());
- else
- this->Assign(other.status());
- return *this;
-}
-
-template
-template ::value>::type*>
-inline StatusOr::StatusOr(StatusOr&& other)
- : Base(static_cast::Base&&>(other)) {}
-
-template
-template ::value>::type*>
-inline StatusOr& StatusOr::operator=(StatusOr&& other) {
- if (other.ok()) {
- this->Assign(std::move(other).ValueOrDie());
- } else {
- this->Assign(std::move(other).status());
- }
- return *this;
-}
-
-template
-const Status& StatusOr::status() const & {
- return this->status_;
-}
-template
-Status StatusOr::status() && {
- return ok() ? Status::OK() : std::move(this->status_);
-}
-
-template
-const T& StatusOr::ValueOrDie() const & {
- this->EnsureOk();
- return this->data_;
-}
-
-template
-T& StatusOr::ValueOrDie() & {
- this->EnsureOk();
- return this->data_;
-}
-
-template
-const T&& StatusOr::ValueOrDie() const && {
- this->EnsureOk();
- return std::move(this->data_);
-}
-
-template
-T&& StatusOr::ValueOrDie() && {
- this->EnsureOk();
- return std::move(this->data_);
-}
-
+// Use steam_executor's StatusOr so we don't duplicate code.
template
-void StatusOr::IgnoreError() const {
- // no-op
-}
+using StatusOr = ::stream_executor::port::StatusOr;
} // namespace xla
diff --git a/tensorflow/stream_executor/BUILD b/tensorflow/stream_executor/BUILD
index c68cda0100..21295abed1 100644
--- a/tensorflow/stream_executor/BUILD
+++ b/tensorflow/stream_executor/BUILD
@@ -33,7 +33,6 @@ cc_library(
}),
visibility = ["//visibility:public"],
deps = [
- "//tensorflow/compiler/xla:statusor",
"//tensorflow/core:lib",
"//tensorflow/core:ptr_util",
"@local_config_cuda//cuda:cuda_headers",
@@ -48,7 +47,6 @@ cc_library(
deps = [
"//tensorflow/core:lib",
"//tensorflow/core:ptr_util",
- "//tensorflow/compiler/xla:statusor",
"@local_config_cuda//cuda:cuda_headers",
] + if_static([":stream_executor_impl"]),
)
diff --git a/tensorflow/compiler/xla/statusor.cc b/tensorflow/stream_executor/lib/statusor.cc
similarity index 89%
rename from tensorflow/compiler/xla/statusor.cc
rename to tensorflow/stream_executor/lib/statusor.cc
index 72ab67ff81..e0e851f96e 100644
--- a/tensorflow/compiler/xla/statusor.cc
+++ b/tensorflow/stream_executor/lib/statusor.cc
@@ -13,12 +13,13 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
-#include "tensorflow/compiler/xla/statusor.h"
+#include "tensorflow/stream_executor/lib/statusor.h"
#include "tensorflow/core/lib/core/errors.h"
#include "tensorflow/core/platform/logging.h"
-namespace xla {
+namespace stream_executor {
+namespace port {
namespace internal_statusor {
void Helper::HandleInvalidStatusCtorArg(Status* status) {
@@ -35,4 +36,5 @@ void Helper::Crash(const Status& status) {
}
} // namespace internal_statusor
-} // namespace xla
+} // namespace port
+} // namespace stream_executor
diff --git a/tensorflow/stream_executor/lib/statusor.h b/tensorflow/stream_executor/lib/statusor.h
index dab5909674..3c716acb46 100644
--- a/tensorflow/stream_executor/lib/statusor.h
+++ b/tensorflow/stream_executor/lib/statusor.h
@@ -1,4 +1,4 @@
-/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
+/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,19 +13,297 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
-// IWYU pragma: private, include "third_party/tensorflow/stream_executor/stream_executor.h"
-
+// StatusOr is the union of a Status object and a T object. StatusOr models
+// the concept of an object that is either a value, or an error Status
+// explaining why such a value is not present. To this end, StatusOr does not
+// allow its Status value to be Status::OK.
+//
+// The primary use-case for StatusOr is as the return value of a
+// function which may fail.
+//
+// Example client usage for a StatusOr, where T is not a pointer:
+//
+// StatusOr result = DoBigCalculationThatCouldFail();
+// if (result.ok()) {
+// float answer = result.ValueOrDie();
+// printf("Big calculation yielded: %f", answer);
+// } else {
+// LOG(ERROR) << result.status();
+// }
+//
+// Example client usage for a StatusOr:
+//
+// StatusOr result = FooFactory::MakeNewFoo(arg);
+// if (result.ok()) {
+// std::unique_ptr foo(result.ValueOrDie());
+// foo->DoSomethingCool();
+// } else {
+// LOG(ERROR) << result.status();
+// }
+//
+// Example client usage for a StatusOr>:
+//
+// StatusOr> result = FooFactory::MakeNewFoo(arg);
+// if (result.ok()) {
+// std::unique_ptr foo = std::move(result.ValueOrDie());
+// foo->DoSomethingCool();
+// } else {
+// LOG(ERROR) << result.status();
+// }
+//
+// Example factory implementation returning StatusOr:
+//
+// StatusOr FooFactory::MakeNewFoo(int arg) {
+// if (arg <= 0) {
+// return tensorflow::InvalidArgument("Arg must be positive");
+// } else {
+// return new Foo(arg);
+// }
+// }
+//
+// Note that the assignment operators require that destroying the currently
+// stored value cannot invalidate the argument; in other words, the argument
+// cannot be an alias for the current value, or anything owned by the current
+// value.
#ifndef TENSORFLOW_STREAM_EXECUTOR_LIB_STATUSOR_H_
#define TENSORFLOW_STREAM_EXECUTOR_LIB_STATUSOR_H_
-#include "tensorflow/compiler/xla/statusor.h"
+#include "tensorflow/core/platform/macros.h"
+#include "tensorflow/stream_executor/lib/status.h"
+#include "tensorflow/stream_executor/lib/statusor_internals.h"
namespace stream_executor {
namespace port {
-// Use XLA's StatusOr so we don't duplicate code.
+#if defined(__clang__)
+// Only clang supports warn_unused_result as a type annotation.
+template
+class TF_MUST_USE_RESULT StatusOr;
+#endif
+
+template
+class StatusOr : private internal_statusor::StatusOrData,
+ private internal_statusor::TraitsBase<
+ std::is_copy_constructible::value,
+ std::is_move_constructible::value> {
+ template
+ friend class StatusOr;
+
+ typedef internal_statusor::StatusOrData Base;
+
+ public:
+ typedef T element_type;
+
+ // Constructs a new StatusOr with Status::UNKNOWN status. This is marked
+ // 'explicit' to try to catch cases like 'return {};', where people think
+ // StatusOr> will be initialized with an empty vector,
+ // instead of a Status::UNKNOWN status.
+ explicit StatusOr();
+
+ // StatusOr will be copy constructible/assignable if T is copy
+ // constructible.
+ StatusOr(const StatusOr&) = default;
+ StatusOr& operator=(const StatusOr&) = default;
+
+ // StatusOr will be move constructible/assignable if T is move
+ // constructible.
+ StatusOr(StatusOr&&) = default;
+ StatusOr& operator=(StatusOr&&) = default;
+
+ // Conversion copy/move constructor, T must be convertible from U.
+ template ::value>::type* = nullptr>
+ StatusOr(const StatusOr& other);
+ template ::value>::type* = nullptr>
+ StatusOr(StatusOr&& other);
+
+ // Conversion copy/move assignment operator, T must be convertible from U.
+ template ::value>::type* = nullptr>
+ StatusOr& operator=(const StatusOr& other);
+ template ::value>::type* = nullptr>
+ StatusOr& operator=(StatusOr&& other);
+
+ // Constructs a new StatusOr with the given value. After calling this
+ // constructor, calls to ValueOrDie() will succeed, and calls to status() will
+ // return OK.
+ //
+ // NOTE: Not explicit - we want to use StatusOr as a return type
+ // so it is convenient and sensible to be able to do 'return T()'
+ // when the return type is StatusOr.
+ //
+ // REQUIRES: T is copy constructible.
+ StatusOr(const T& value);
+
+ // Constructs a new StatusOr with the given non-ok status. After calling
+ // this constructor, calls to ValueOrDie() will CHECK-fail.
+ //
+ // NOTE: Not explicit - we want to use StatusOr as a return
+ // value, so it is convenient and sensible to be able to do 'return
+ // Status()' when the return type is StatusOr.
+ //
+ // REQUIRES: !status.ok(). This requirement is DCHECKed.
+ // In optimized builds, passing Status::OK() here will have the effect
+ // of passing tensorflow::error::INTERNAL as a fallback.
+ StatusOr(const Status& status);
+ StatusOr& operator=(const Status& status);
+
+ // TODO(b/62186997): Add operator=(T) overloads.
+
+ // Similar to the `const T&` overload.
+ //
+ // REQUIRES: T is move constructible.
+ StatusOr(T&& value);
+
+ // RValue versions of the operations declared above.
+ StatusOr(Status&& status);
+ StatusOr& operator=(Status&& status);
+
+ // Returns this->status().ok()
+ bool ok() const { return this->status_.ok(); }
+
+ // Returns a reference to our status. If this contains a T, then
+ // returns Status::OK().
+ const Status& status() const &;
+ Status status() &&;
+
+ // Returns a reference to our current value, or CHECK-fails if !this->ok().
+ //
+ // Note: for value types that are cheap to copy, prefer simple code:
+ //
+ // T value = statusor.ValueOrDie();
+ //
+ // Otherwise, if the value type is expensive to copy, but can be left
+ // in the StatusOr, simply assign to a reference:
+ //
+ // T& value = statusor.ValueOrDie(); // or `const T&`
+ //
+ // Otherwise, if the value type supports an efficient move, it can be
+ // used as follows:
+ //
+ // T value = std::move(statusor).ValueOrDie();
+ //
+ // The std::move on statusor instead of on the whole expression enables
+ // warnings about possible uses of the statusor object after the move.
+ // C++ style guide waiver for ref-qualified overloads granted in cl/143176389
+ // See go/ref-qualifiers for more details on such overloads.
+ const T& ValueOrDie() const &;
+ T& ValueOrDie() &;
+ const T&& ValueOrDie() const &&;
+ T&& ValueOrDie() &&;
+
+ T ConsumeValueOrDie() { return std::move(ValueOrDie()); }
+
+ // Ignores any errors. This method does nothing except potentially suppress
+ // complaints from any tools that are checking that errors are not dropped on
+ // the floor.
+ void IgnoreError() const;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// Implementation details for StatusOr
+
+template
+StatusOr::StatusOr() : Base(Status(tensorflow::error::UNKNOWN, "")) {}
+
+template
+StatusOr::StatusOr(const T& value) : Base(value) {}
+
+template
+StatusOr::StatusOr(const Status& status) : Base(status) {}
+
+template
+StatusOr& StatusOr::operator=(const Status& status) {
+ this->Assign(status);
+ return *this;
+}
+
+template
+StatusOr::StatusOr(T&& value) : Base(std::move(value)) {}
+
+template
+StatusOr::StatusOr(Status&& status) : Base(std::move(status)) {}
+
+template
+StatusOr& StatusOr::operator=(Status&& status) {
+ this->Assign(std::move(status));
+ return *this;
+}
+
+template
+template ::value>::type*>
+inline StatusOr::StatusOr(const StatusOr& other)
+ : Base(static_cast::Base&>(other)) {}
+
+template
+template ::value>::type*>
+inline StatusOr& StatusOr::operator=(const StatusOr& other) {
+ if (other.ok())
+ this->Assign(other.ValueOrDie());
+ else
+ this->Assign(other.status());
+ return *this;
+}
+
+template
+template ::value>::type*>
+inline StatusOr::StatusOr(StatusOr&& other)
+ : Base(static_cast::Base&&>(other)) {}
+
+template
+template ::value>::type*>
+inline StatusOr& StatusOr::operator=(StatusOr&& other) {
+ if (other.ok()) {
+ this->Assign(std::move(other).ValueOrDie());
+ } else {
+ this->Assign(std::move(other).status());
+ }
+ return *this;
+}
+
+template
+const Status& StatusOr::status() const & {
+ return this->status_;
+}
+template
+Status StatusOr::status() && {
+ return ok() ? Status::OK() : std::move(this->status_);
+}
+
+template
+const T& StatusOr::ValueOrDie() const & {
+ this->EnsureOk();
+ return this->data_;
+}
+
+template
+T& StatusOr::ValueOrDie() & {
+ this->EnsureOk();
+ return this->data_;
+}
+
+template
+const T&& StatusOr::ValueOrDie() const && {
+ this->EnsureOk();
+ return std::move(this->data_);
+}
+
+template
+T&& StatusOr::ValueOrDie() && {
+ this->EnsureOk();
+ return std::move(this->data_);
+}
+
template
-using StatusOr = ::xla::StatusOr;
+void StatusOr::IgnoreError() const {
+ // no-op
+}
} // namespace port
} // namespace stream_executor
diff --git a/tensorflow/compiler/xla/statusor_internals.h b/tensorflow/stream_executor/lib/statusor_internals.h
similarity index 94%
rename from tensorflow/compiler/xla/statusor_internals.h
rename to tensorflow/stream_executor/lib/statusor_internals.h
index 14636bd144..09f88f5825 100644
--- a/tensorflow/compiler/xla/statusor_internals.h
+++ b/tensorflow/stream_executor/lib/statusor_internals.h
@@ -13,13 +13,15 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
-#ifndef TENSORFLOW_COMPILER_XLA_STATUSOR_INTERNALS_H_
-#define TENSORFLOW_COMPILER_XLA_STATUSOR_INTERNALS_H_
+#ifndef TENSORFLOW_STREAM_EXECUTOR_LIB_STATUSOR_INTERNALS_H_
+#define TENSORFLOW_STREAM_EXECUTOR_LIB_STATUSOR_INTERNALS_H_
+
-#include "tensorflow/compiler/xla/status.h"
#include "tensorflow/core/platform/macros.h"
+#include "tensorflow/stream_executor/lib/status.h"
-namespace xla {
+namespace stream_executor {
+namespace port {
namespace internal_statusor {
class Helper {
@@ -240,6 +242,7 @@ struct TraitsBase {
};
} // namespace internal_statusor
-} // namespace xla
+} // namespace port
+} // namespace stream_executor
-#endif // TENSORFLOW_COMPILER_XLA_STATUSOR_INTERNALS_H_
+#endif // TENSORFLOW_STREAM_EXECUTOR_LIB_STATUSOR_INTERNALS_H_
diff --git a/tensorflow/compiler/xla/statusor_test.cc b/tensorflow/stream_executor/lib/statusor_test.cc
similarity index 99%
rename from tensorflow/compiler/xla/statusor_test.cc
rename to tensorflow/stream_executor/lib/statusor_test.cc
index 377a618ffb..56584e1892 100644
--- a/tensorflow/compiler/xla/statusor_test.cc
+++ b/tensorflow/stream_executor/lib/statusor_test.cc
@@ -15,18 +15,18 @@ limitations under the License.
// Unit tests for StatusOr
-#include "tensorflow/compiler/xla/statusor.h"
+#include "tensorflow/stream_executor/lib/statusor.h"
#include
#include
-#include "tensorflow/compiler/xla/test.h"
-#include "tensorflow/compiler/xla/types.h"
+#include "tensorflow/core/platform/test.h"
#include "tensorflow/core/lib/core/errors.h"
#include "tensorflow/core/platform/macros.h"
#include "tensorflow/core/platform/test_benchmark.h"
-namespace xla {
+namespace stream_executor {
+namespace port {
namespace {
class Base1 {
@@ -672,4 +672,5 @@ void BM_StatusOrFactoryFailLongMsg(int iters) {
BENCHMARK(BM_StatusOrFactoryFailLongMsg);
} // namespace
-} // namespace xla
+} // namespace port
+} // namespace stream_executor
--
GitLab
From b8c1732664f41d5af2587e2f093880a3a7d83f43 Mon Sep 17 00:00:00 2001
From: Michael Case
Date: Tue, 26 Jun 2018 15:07:23 -0700
Subject: [PATCH 054/519] Fix small typo in RELEASE.md
---
RELEASE.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/RELEASE.md b/RELEASE.md
index 879b995a5a..52cd9ef72b 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -21,7 +21,7 @@
* The [distributions.Bijector](https://www.tensorflow.org/versions/r1.9/api_docs/python/tf/contrib/distributions/bijectors/Bijector)
API supports broadcasting for Bijectors with new API changes.
-## Breaking Chances
+## Breaking Changes
* If you're opening empty variable scopes; replace `variable_scope('', ...)` by
`variable_scope(tf.get_variable_scope(), ...)`.
--
GitLab
From 74ca837950536aaef358abf3e05b31b4d62248f7 Mon Sep 17 00:00:00 2001
From: Gunhan Gulsoy
Date: Tue, 26 Jun 2018 15:29:48 -0700
Subject: [PATCH 055/519] Update eigen version to a fixed version for ppc64.
---
tensorflow/workspace.bzl | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl
index 3c657c4a5b..79274d66ad 100644
--- a/tensorflow/workspace.bzl
+++ b/tensorflow/workspace.bzl
@@ -107,11 +107,11 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
tf_http_archive(
name = "eigen_archive",
urls = [
- "https://mirror.bazel.build/bitbucket.org/eigen/eigen/get/e5e305a158a0.tar.gz",
- "https://bitbucket.org/eigen/eigen/get/e5e305a158a0.tar.gz",
+ "https://mirror.bazel.build/bitbucket.org/eigen/eigen/get/fd6845384b86.tar.gz",
+ "https://bitbucket.org/eigen/eigen/get/fd6845384b86.tar.gz",
],
- sha256 = "8bbe676d69e7f59070c83a949454b8b6344034e0ebbf686b337528e5dc04c7de",
- strip_prefix = "eigen-eigen-e5e305a158a0",
+ sha256 = "d956415d784fa4e42b6a2a45c32556d6aec9d0a3d8ef48baee2522ab762556a9",
+ strip_prefix = "eigen-eigen-fd6845384b86",
build_file = clean_dep("//third_party:eigen.BUILD"),
)
--
GitLab
From 388a267b1191adf2df4006bf205a19b8a24813db Mon Sep 17 00:00:00 2001
From: Billy Lamberta
Date: Tue, 26 Jun 2018 11:24:37 -0700
Subject: [PATCH 056/519] Remove section links that don't go anywhere.
---
tensorflow/docs_src/get_started/_index.yaml | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/tensorflow/docs_src/get_started/_index.yaml b/tensorflow/docs_src/get_started/_index.yaml
index 277fc852fb..4060804892 100644
--- a/tensorflow/docs_src/get_started/_index.yaml
+++ b/tensorflow/docs_src/get_started/_index.yaml
@@ -66,9 +66,7 @@ landing_page:
}
-
- Learn and use ML
-
+
Learn and use ML
The high-level Keras API provides building blocks to create and
@@ -117,9 +115,7 @@ landing_page:
- items:
- custom_html: >
-
- Research and experimentation
-
+
Research and experimentation
Eager execution provides an imperative, define-by-run interface for advanced operations. Write custom layers, forward passes, and training loops with auto‑differentiation. Start with
@@ -170,9 +166,7 @@ landing_page:
- custom_html: >
-
- ML at production scale
-
+
ML at production scale
Estimators can train large models on multiple machines in a
--
GitLab
From 9f4fbdb05e35b512dd4a3da5ae80558021a291e5 Mon Sep 17 00:00:00 2001
From: Billy Lamberta
Date: Tue, 26 Jun 2018 14:56:57 -0700
Subject: [PATCH 057/519] Fix leftnav for get_started
---
tensorflow/docs_src/get_started/leftnav_files | 6 +++---
tensorflow/docs_src/get_started/next_steps.md | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tensorflow/docs_src/get_started/leftnav_files b/tensorflow/docs_src/get_started/leftnav_files
index 5c400a67f0..99d2b2c3e1 100644
--- a/tensorflow/docs_src/get_started/leftnav_files
+++ b/tensorflow/docs_src/get_started/leftnav_files
@@ -1,7 +1,7 @@
### Learn and use ML
-basic_classification.md
-basic_text_classification.md
-basic_regression.md
+basic_classification.md: Basic classification
+basic_text_classification.md: Text classification
+basic_regression.md: Regression
overfit_and_underfit.md
save_and_restore_models.md
next_steps.md
diff --git a/tensorflow/docs_src/get_started/next_steps.md b/tensorflow/docs_src/get_started/next_steps.md
index 6318a39c6c..01c9f7204a 100644
--- a/tensorflow/docs_src/get_started/next_steps.md
+++ b/tensorflow/docs_src/get_started/next_steps.md
@@ -1,4 +1,4 @@
-# Next Steps
+# Next steps
## Learn more about TensorFlow
--
GitLab
From 9809978ea09845d5429925b64c20cda461c20a66 Mon Sep 17 00:00:00 2001
From: Billy Lamberta
Date: Tue, 26 Jun 2018 21:34:07 -0700
Subject: [PATCH 058/519] Fix checkpoints link in keras guide
---
tensorflow/docs_src/guide/keras.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tensorflow/docs_src/guide/keras.md b/tensorflow/docs_src/guide/keras.md
index 83172dab7f..c799e9b12c 100644
--- a/tensorflow/docs_src/guide/keras.md
+++ b/tensorflow/docs_src/guide/keras.md
@@ -35,7 +35,7 @@ from tensorflow import keras
* The `tf.keras` version in the latest TensorFlow release might not be the same
as the latest `keras` version from PyPI. Check `tf.keras.__version__`.
* When [saving a model's weights](#weights_only), `tf.keras` defaults to the
- [checkpoint format](../get_started/checkpoints.md). Pass `save_format='h5'` to
+ [checkpoint format](./checkpoints.md). Pass `save_format='h5'` to
use HDF5.
## Build a simple model
@@ -442,7 +442,7 @@ model.load_weights('my_model')
```
By default, this saves the model's weights in the
-[TensorFlow checkpoint](../get_started/checkpoints.md) file format. Weights can
+[TensorFlow checkpoint](./checkpoints.md) file format. Weights can
also be saved to the Keras HDF5 format (the default for the multi-backend
implementation of Keras):
--
GitLab
From 32d4e6fd74fbeb91c8b2fd06c5ab0d4247d1784d Mon Sep 17 00:00:00 2001
From: Michael Case
Date: Wed, 27 Jun 2018 09:46:45 -0700
Subject: [PATCH 059/519] Update version strings for TF 1.9.0-rc2.
---
tensorflow/core/public/version.h | 2 +-
tensorflow/docs_src/install/install_c.md | 2 +-
tensorflow/docs_src/install/install_go.md | 2 +-
tensorflow/docs_src/install/install_java.md | 22 +++++++++----------
tensorflow/docs_src/install/install_linux.md | 18 +++++++--------
tensorflow/docs_src/install/install_mac.md | 10 ++++-----
.../docs_src/install/install_sources.md | 4 ++--
tensorflow/tools/pip_package/setup.py | 2 +-
8 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/tensorflow/core/public/version.h b/tensorflow/core/public/version.h
index 9e5e747557..0e4a61ac1f 100644
--- a/tensorflow/core/public/version.h
+++ b/tensorflow/core/public/version.h
@@ -24,7 +24,7 @@ limitations under the License.
// TF_VERSION_SUFFIX is non-empty for pre-releases (e.g. "-alpha", "-alpha.1",
// "-beta", "-rc", "-rc.1")
-#define TF_VERSION_SUFFIX "-rc1"
+#define TF_VERSION_SUFFIX "-rc2"
#define TF_STR_HELPER(x) #x
#define TF_STR(x) TF_STR_HELPER(x)
diff --git a/tensorflow/docs_src/install/install_c.md b/tensorflow/docs_src/install/install_c.md
index 2f81ae0c40..9aebf2bfa4 100644
--- a/tensorflow/docs_src/install/install_c.md
+++ b/tensorflow/docs_src/install/install_c.md
@@ -38,7 +38,7 @@ enable TensorFlow for C:
OS="linux" # Change to "darwin" for macOS
TARGET_DIRECTORY="/usr/local"
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-${OS}-x86_64-1.9.0-rc1.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-${OS}-x86_64-1.9.0-rc2.tar.gz" |
sudo tar -C $TARGET_DIRECTORY -xz
The `tar` command extracts the TensorFlow C library into the `lib`
diff --git a/tensorflow/docs_src/install/install_go.md b/tensorflow/docs_src/install/install_go.md
index 5451e1b319..1907355341 100644
--- a/tensorflow/docs_src/install/install_go.md
+++ b/tensorflow/docs_src/install/install_go.md
@@ -38,7 +38,7 @@ steps to install this library and enable TensorFlow for Go:
TF_TYPE="cpu" # Change to "gpu" for GPU support
TARGET_DIRECTORY='/usr/local'
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-$(go env GOOS)-x86_64-1.9.0-rc1.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-$(go env GOOS)-x86_64-1.9.0-rc2.tar.gz" |
sudo tar -C $TARGET_DIRECTORY -xz
The `tar` command extracts the TensorFlow C library into the `lib`
diff --git a/tensorflow/docs_src/install/install_java.md b/tensorflow/docs_src/install/install_java.md
index ad3544b595..b9c9912816 100644
--- a/tensorflow/docs_src/install/install_java.md
+++ b/tensorflow/docs_src/install/install_java.md
@@ -36,7 +36,7 @@ following to the project's `pom.xml` to use the TensorFlow Java APIs:
org.tensorflow
tensorflow
- 1.9.0-rc1
+ 1.9.0-rc2
```
@@ -65,7 +65,7 @@ As an example, these steps will create a Maven project that uses TensorFlow:
org.tensorflow
tensorflow
- 1.9.0-rc1
+ 1.9.0-rc2
@@ -124,12 +124,12 @@ instead:
org.tensorflow
libtensorflow
- 1.9.0-rc1
+ 1.9.0-rc2
org.tensorflow
libtensorflow_jni_gpu
- 1.9.0-rc1
+ 1.9.0-rc2
```
@@ -148,7 +148,7 @@ refer to the simpler instructions above instead.
Take the following steps to install TensorFlow for Java on Linux or macOS:
1. Download
- [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc1.jar),
+ [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc2.jar),
which is the TensorFlow Java Archive (JAR).
2. Decide whether you will run TensorFlow for Java on CPU(s) only or with
@@ -167,7 +167,7 @@ Take the following steps to install TensorFlow for Java on Linux or macOS:
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
mkdir -p ./jni
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-${TF_TYPE}-${OS}-x86_64-1.9.0-rc1.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-${TF_TYPE}-${OS}-x86_64-1.9.0-rc2.tar.gz" |
tar -xz -C ./jni
### Install on Windows
@@ -175,10 +175,10 @@ Take the following steps to install TensorFlow for Java on Linux or macOS:
Take the following steps to install TensorFlow for Java on Windows:
1. Download
- [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc1.jar),
+ [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc2.jar),
which is the TensorFlow Java Archive (JAR).
2. Download the following Java Native Interface (JNI) file appropriate for
- [TensorFlow for Java on Windows](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-cpu-windows-x86_64-1.9.0-rc1.zip).
+ [TensorFlow for Java on Windows](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-cpu-windows-x86_64-1.9.0-rc2.zip).
3. Extract this .zip file.
@@ -227,7 +227,7 @@ must be part of your `classpath`. For example, you can include the
downloaded `.jar` in your `classpath` by using the `-cp` compilation flag
as follows:
-javac -cp libtensorflow-1.9.0-rc1.jar HelloTF.java
+javac -cp libtensorflow-1.9.0-rc2.jar HelloTF.java
### Running
@@ -241,11 +241,11 @@ two files are available to the JVM:
For example, the following command line executes the `HelloTF` program on Linux
and macOS X:
-java -cp libtensorflow-1.9.0-rc1.jar:. -Djava.library.path=./jni HelloTF
+java -cp libtensorflow-1.9.0-rc2.jar:. -Djava.library.path=./jni HelloTF
And the following command line executes the `HelloTF` program on Windows:
-java -cp libtensorflow-1.9.0-rc1.jar;. -Djava.library.path=jni HelloTF
+java -cp libtensorflow-1.9.0-rc2.jar;. -Djava.library.path=jni HelloTF
If the program prints Hello from version, you've successfully
installed TensorFlow for Java and are ready to use the API. If the program
diff --git a/tensorflow/docs_src/install/install_linux.md b/tensorflow/docs_src/install/install_linux.md
index 41619ca230..ae3d50ff39 100644
--- a/tensorflow/docs_src/install/install_linux.md
+++ b/tensorflow/docs_src/install/install_linux.md
@@ -438,7 +438,7 @@ Take the following steps to install TensorFlow in an Anaconda environment:
(tensorflow)$ pip install --ignore-installed --upgrade \
- https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc1-cp34-cp34m-linux_x86_64.whl
+ https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp34-cp34m-linux_x86_64.whl
## Validate your installation
@@ -678,14 +678,14 @@ This section documents the relevant values for Linux installations.
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc1-cp27-none-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp27-none-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc1-cp27-none-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp27-none-linux_x86_64.whl
Note that GPU support requires the NVIDIA hardware and software described in
@@ -697,14 +697,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc1-cp34-cp34m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp34-cp34m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc1-cp34-cp34m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp34-cp34m-linux_x86_64.whl
Note that GPU support requires the NVIDIA hardware and software described in
@@ -716,14 +716,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc1-cp35-cp35m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp35-cp35m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc1-cp35-cp35m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp35-cp35m-linux_x86_64.whl
@@ -735,14 +735,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc1-cp36-cp36m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp36-cp36m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc1-cp36-cp36m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp36-cp36m-linux_x86_64.whl
diff --git a/tensorflow/docs_src/install/install_mac.md b/tensorflow/docs_src/install/install_mac.md
index eeca389617..3de6da1342 100644
--- a/tensorflow/docs_src/install/install_mac.md
+++ b/tensorflow/docs_src/install/install_mac.md
@@ -119,7 +119,7 @@ Take the following steps to install TensorFlow with Virtualenv:
TensorFlow in the active Virtualenv is as follows:
$ pip3 install --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc1-py3-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py3-none-any.whl
If you encounter installation problems, see
[Common Installation Problems](#common-installation-problems).
@@ -242,7 +242,7 @@ take the following steps:
issue the following command:
$ sudo pip3 install --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc1-py3-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py3-none-any.whl
If the preceding command fails, see
[installation problems](#common-installation-problems).
@@ -350,7 +350,7 @@ Take the following steps to install TensorFlow in an Anaconda environment:
TensorFlow for Python 2.7:
(targetDirectory)$ pip install --ignore-installed --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc1-py2-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py2-none-any.whl
@@ -518,7 +518,7 @@ The value you specify depends on your Python version.
-https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc1-py2-none-any.whl
+https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py2-none-any.whl
@@ -526,5 +526,5 @@ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc1-py2-none-a
-https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc1-py3-none-any.whl
+https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py3-none-any.whl
diff --git a/tensorflow/docs_src/install/install_sources.md b/tensorflow/docs_src/install/install_sources.md
index 7afcd340aa..3520f97c9a 100644
--- a/tensorflow/docs_src/install/install_sources.md
+++ b/tensorflow/docs_src/install/install_sources.md
@@ -328,10 +328,10 @@ Invoke `pip install` to install that pip package.
The filename of the `.whl` file depends on your platform.
For example, the following command will install the pip package
-for TensorFlow 1.9.0rc1 on Linux:
+for TensorFlow 1.9.0rc2 on Linux:
-$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.9.0rc1-py2-none-any.whl
+$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.9.0rc2-py2-none-any.whl
## Validate your installation
diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py
index eb2e359ee5..ed7ce01b6b 100644
--- a/tensorflow/tools/pip_package/setup.py
+++ b/tensorflow/tools/pip_package/setup.py
@@ -45,7 +45,7 @@ DOCLINES = __doc__.split('\n')
# This version string is semver compatible, but incompatible with pip.
# For pip, we will remove all '-' characters from this string, and use the
# result for pip.
-_VERSION = '1.9.0-rc1'
+_VERSION = '1.9.0-rc2'
REQUIRED_PACKAGES = [
'absl-py >= 0.1.6',
--
GitLab
From f93e1b07282216d77e9d7d704f6722a893e9ef73 Mon Sep 17 00:00:00 2001
From: Michael Case
Date: Thu, 28 Jun 2018 11:24:37 -0700
Subject: [PATCH 060/519] Potential fix for how pip installs headers used for
custom ops.
These headers were recently moved from site-packages/external into
site-packages/tensorflow/include/external. Need to update setup.py
to reflect that.
---
RELEASE.md | 1 +
tensorflow/tools/pip_package/setup.py | 10 +++++-----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/RELEASE.md b/RELEASE.md
index 52cd9ef72b..21207a7efa 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -24,6 +24,7 @@
## Breaking Changes
* If you're opening empty variable scopes; replace `variable_scope('', ...)` by
`variable_scope(tf.get_variable_scope(), ...)`.
+ * Headers used for building custom ops have been moved from site-packages/external into site-packages/tensorflow/include/external.
## Bug Fixes and Other Changes
diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py
index ed7ce01b6b..8c077580aa 100644
--- a/tensorflow/tools/pip_package/setup.py
+++ b/tensorflow/tools/pip_package/setup.py
@@ -170,8 +170,9 @@ class InstallHeaders(Command):
# symlink within the directory hierarchy.
# NOTE(keveman): Figure out how to customize bdist_wheel package so
# we can do the symlink.
- if 'external/eigen_archive/' in install_dir:
- extra_dir = install_dir.replace('external/eigen_archive', '')
+ if 'tensorflow/include/external/eigen_archive/' in install_dir:
+ extra_dir = install_dir.replace(
+ 'tensorflow/include/external/eigen_archive', '')
if not os.path.exists(extra_dir):
self.mkpath(extra_dir)
self.copy_file(header, extra_dir)
@@ -204,13 +205,12 @@ def find_files(pattern, root):
yield os.path.join(dirpath, filename)
-matches = ['../' + x for x in find_files('*', 'external') if '.py' not in x]
-
so_lib_paths = [
i for i in os.listdir('.')
if os.path.isdir(i) and fnmatch.fnmatch(i, '_solib_*')
]
+matches = []
for path in so_lib_paths:
matches.extend(
['../' + x for x in find_files('*', path) if '.py' not in x]
@@ -225,7 +225,7 @@ headers = (list(find_files('*.h', 'tensorflow/core')) +
list(find_files('*.h', 'tensorflow/stream_executor')) +
list(find_files('*.h', 'google/protobuf_archive/src')) +
list(find_files('*', 'third_party/eigen3')) +
- list(find_files('*', 'external/eigen_archive')))
+ list(find_files('*', 'tensorflow/include/external/eigen_archive')))
setup(
name=project_name,
--
GitLab
From f09aaf0dd33869253020b095d7c44840d1b430fe Mon Sep 17 00:00:00 2001
From: Michael Case
Date: Fri, 29 Jun 2018 10:19:06 -0700
Subject: [PATCH 061/519] Exclude test sources from stream executor builds.
(#20423)
PiperOrigin-RevId: 202423156
---
tensorflow/contrib/cmake/tf_stream_executor.cmake | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tensorflow/contrib/cmake/tf_stream_executor.cmake b/tensorflow/contrib/cmake/tf_stream_executor.cmake
index 9a37b68119..2f70e59d54 100644
--- a/tensorflow/contrib/cmake/tf_stream_executor.cmake
+++ b/tensorflow/contrib/cmake/tf_stream_executor.cmake
@@ -76,11 +76,11 @@ if (tensorflow_ENABLE_GPU)
list(APPEND tf_stream_executor_srcs ${tf_stream_executor_gpu_srcs})
endif()
-#file(GLOB_RECURSE tf_stream_executor_test_srcs
-# "${tensorflow_source_dir}/tensorflow/stream_executor/*_test.cc"
-# "${tensorflow_source_dir}/tensorflow/stream_executor/*_test.h"
-#)
-#list(REMOVE_ITEM tf_stream_executor_srcs ${tf_stream_executor_test_srcs})
+file(GLOB_RECURSE tf_stream_executor_test_srcs
+ "${tensorflow_source_dir}/tensorflow/stream_executor/*test.cc"
+ "${tensorflow_source_dir}/tensorflow/stream_executor/lib/*test.h"
+)
+list(REMOVE_ITEM tf_stream_executor_srcs ${tf_stream_executor_test_srcs})
if (NOT WIN32)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lgomp")
--
GitLab
From 648ef712f2c4fc996551373765aff30a0e48bc4c Mon Sep 17 00:00:00 2001
From: bhack
Date: Sat, 30 Jun 2018 14:54:43 +0200
Subject: [PATCH 062/519] Advise batch_normalization with model_to_estimator
---
tensorflow/docs_src/guide/keras.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tensorflow/docs_src/guide/keras.md b/tensorflow/docs_src/guide/keras.md
index c799e9b12c..d584ebe945 100644
--- a/tensorflow/docs_src/guide/keras.md
+++ b/tensorflow/docs_src/guide/keras.md
@@ -548,9 +548,11 @@ model.compile(optimizer=tf.train.RMSPropOptimizer(0.001),
estimator = keras.estimator.model_to_estimator(model)
```
-Note: Enable [eager execution](./eager.md) for debugging
+Note:
+* Enable [eager execution](./eager.md) for debugging
[Estimator input functions](./premade_estimators.md#create_input_functions)
and inspecting data.
+* Don't use batch normalization or try to finetune batch normalization models with estimators created from `tf.keras.estimator.model_to_estimator`. More details at [#17950](https://github.com/tensorflow/tensorflow/issues/17950)
### Multiple GPUs
--
GitLab
From 8fab75ff2e551414d093b8fc3b3e4a78bf91754d Mon Sep 17 00:00:00 2001
From: Yong Tang
Date: Sat, 30 Jun 2018 16:12:27 +0000
Subject: [PATCH 063/519] Update .gitignore for cmake generated file
While running cmake in Linux:
```
tensorflow/tools/ci_build/ci_build.sh CMAKE tensorflow/tools/ci_build/builds/cmake.sh
```
the following file is generated and left out:
```
ubuntu@ubuntu:~/tensorflow$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add ..." to include in what will be committed)
estimator_api_init_files_list.txt
nothing added to commit but untracked files present (use "git add" to track)
```
This fix add `/estimator_api_init_files_list.txt`
in gitignore so that it will not be picked by `git add -A`.
Signed-off-by: Yong Tang
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index b5306b8b79..5afe375f46 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,6 +29,7 @@ Podfile.lock
/tensorflow/contrib/lite/examples/ios/simple/data/*.tflite
xcuserdata/**
/api_init_files_list.txt
+/estimator_api_init_files_list.txt
# Android
.gradle
--
GitLab
From 9281603eeb149942952e3d8b35c2a121bbaa045e Mon Sep 17 00:00:00 2001
From: Paul Woitaschek
Date: Sun, 1 Jul 2018 15:08:07 +0200
Subject: [PATCH 064/519] Added minSdkVersion to the manifest
Fixes #20453
---
tensorflow/contrib/lite/java/AndroidManifest.xml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tensorflow/contrib/lite/java/AndroidManifest.xml b/tensorflow/contrib/lite/java/AndroidManifest.xml
index f705feacbe..d9e10900bf 100644
--- a/tensorflow/contrib/lite/java/AndroidManifest.xml
+++ b/tensorflow/contrib/lite/java/AndroidManifest.xml
@@ -1,6 +1,9 @@
+
+
+
--
GitLab
From 1d7fcde539fcff854e261c375c8ec2fbff258c34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E5=A4=A9=E5=90=AF?=
Date: Sun, 1 Jul 2018 22:05:51 +0800
Subject: [PATCH 065/519] fix bug in maxout function
The line "shape[axis] = -1" will make the shape wrong when dealing with batches with arbitrary sizes.
---
tensorflow/contrib/layers/python/layers/layers.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tensorflow/contrib/layers/python/layers/layers.py b/tensorflow/contrib/layers/python/layers/layers.py
index b7194ae333..a55d42c151 100644
--- a/tensorflow/contrib/layers/python/layers/layers.py
+++ b/tensorflow/contrib/layers/python/layers/layers.py
@@ -3117,7 +3117,7 @@ def maxout(inputs, num_units, axis=-1, scope=None):
raise ValueError('number of features({}) is not '
'a multiple of num_units({})'.format(
num_channels, num_units))
- shape[axis] = -1
+ shape[axis] = num_units
shape += [num_channels // num_units]
# Dealing with batches with arbitrary sizes
--
GitLab
From 11cd70438e7d7104904bf8f3b24fcaf6fd88eab5 Mon Sep 17 00:00:00 2001
From: Mark Daoust
Date: Mon, 2 Jul 2018 13:37:38 -0700
Subject: [PATCH 066/519] Fix lint error.
---
tensorflow/contrib/model_pruning/python/pruning.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tensorflow/contrib/model_pruning/python/pruning.py b/tensorflow/contrib/model_pruning/python/pruning.py
index d843fa26d5..da9d398cbc 100644
--- a/tensorflow/contrib/model_pruning/python/pruning.py
+++ b/tensorflow/contrib/model_pruning/python/pruning.py
@@ -520,7 +520,8 @@ class Pruning(object):
thresholds = get_thresholds()
for mask, threshold in zip(masks, thresholds):
if not self._exists_in_do_not_prune_list(mask.name):
- summary.scalar(mask.op.name + '/sparsity', nn_impl.zero_fraction(mask))
+ summary.scalar(mask.op.name + '/sparsity',
+ nn_impl.zero_fraction(mask))
summary.scalar(threshold.op.name + '/threshold', threshold)
def print_hparams(self):
--
GitLab
From f394207e840c6ea72c153fb2bb4e781f63f5e119 Mon Sep 17 00:00:00 2001
From: Paul Woitaschek
Date: Mon, 2 Jul 2018 23:12:26 +0200
Subject: [PATCH 067/519] Added target-sdk as well.
---
tensorflow/contrib/lite/java/AndroidManifest.xml | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tensorflow/contrib/lite/java/AndroidManifest.xml b/tensorflow/contrib/lite/java/AndroidManifest.xml
index d9e10900bf..f954bba739 100644
--- a/tensorflow/contrib/lite/java/AndroidManifest.xml
+++ b/tensorflow/contrib/lite/java/AndroidManifest.xml
@@ -1,10 +1,11 @@
+ package="org.tensorflow.lite">
-
+
-
-
+
+
-
--
GitLab
From 4664191b73959387c190f969d7f1fe3480a585f4 Mon Sep 17 00:00:00 2001
From: Yifei Feng <1192265+yifeif@users.noreply.github.com>
Date: Mon, 2 Jul 2018 17:10:20 -0700
Subject: [PATCH 068/519] Match for path instead of name
---
tensorflow/tools/pip_package/build_pip_package.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tensorflow/tools/pip_package/build_pip_package.sh b/tensorflow/tools/pip_package/build_pip_package.sh
index 9e41514cfa..b0089d3360 100755
--- a/tensorflow/tools/pip_package/build_pip_package.sh
+++ b/tensorflow/tools/pip_package/build_pip_package.sh
@@ -27,7 +27,7 @@ function cp_external() {
pushd .
cd "$src_dir"
- for f in `find . ! -type d ! -name '*.py' ! -name '*local_config_cuda*' ! -name '*local_config_tensorrt*' ! -name '*org_tensorflow*'`; do
+ for f in `find . ! -type d ! -name '*.py' ! -path '*local_config_cuda*' ! -path '*local_config_tensorrt*' ! -path '*org_tensorflow*'`; do
mkdir -p "${dest_dir}/$(dirname ${f})"
cp "${f}" "${dest_dir}/$(dirname ${f})/"
done
--
GitLab
From 2496c49fab2893c9bfb154c4c2b6ae26d410fc3a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BC=A0=E6=99=93=E9=A3=9E?=
<32763586+henry860916@users.noreply.github.com>
Date: Tue, 3 Jul 2018 17:04:19 +0800
Subject: [PATCH 069/519] Update debugger.md
Fix issue of "function object is not subscriptable" in sample code.
---
tensorflow/docs_src/guide/debugger.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tensorflow/docs_src/guide/debugger.md b/tensorflow/docs_src/guide/debugger.md
index dc4db58857..dad11e6226 100644
--- a/tensorflow/docs_src/guide/debugger.md
+++ b/tensorflow/docs_src/guide/debugger.md
@@ -781,7 +781,7 @@ sess.run(b)
``` python
import numpy as np
-a = tf.Variable(np.ones[10], name="a")
+a = tf.Variable(np.ones(10), name="a")
b = tf.add(a, a, name="b")
sess = tf.Session()
sess.run(tf.global_variables_initializer())
--
GitLab
From 69e37cef0ca721f76d12a3808521d73299aab7ea Mon Sep 17 00:00:00 2001
From: Yong Tang
Date: Tue, 3 Jul 2018 12:29:18 +0000
Subject: [PATCH 070/519] Update calling of expand_dims with axis
This fix updates calling of `expand_dims` with `dim -> axis`
as the `dim=` in `tf.expand_dims` has been deprecated and was
generating unnecessary warnings.
Signed-off-by: Yong Tang
---
tensorflow/contrib/learn/python/learn/estimators/head.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tensorflow/contrib/learn/python/learn/estimators/head.py b/tensorflow/contrib/learn/python/learn/estimators/head.py
index 339c4e0e36..dee0755204 100644
--- a/tensorflow/contrib/learn/python/learn/estimators/head.py
+++ b/tensorflow/contrib/learn/python/learn/estimators/head.py
@@ -563,10 +563,10 @@ def _mean_squared_loss(labels, logits, weights=None):
labels = ops.convert_to_tensor(labels)
# To prevent broadcasting inside "-".
if len(labels.get_shape()) == 1:
- labels = array_ops.expand_dims(labels, dim=(1,))
+ labels = array_ops.expand_dims(labels, axis=(1,))
# TODO(zakaria): make sure it does not recreate the broadcast bug.
if len(logits.get_shape()) == 1:
- logits = array_ops.expand_dims(logits, dim=(1,))
+ logits = array_ops.expand_dims(logits, axis=(1,))
logits.get_shape().assert_is_compatible_with(labels.get_shape())
loss = math_ops.square(logits - math_ops.to_float(labels), name=name)
return _compute_weighted_loss(loss, weights)
--
GitLab
From 00071753077dcd9f1486c1335f05eed80e68efcb Mon Sep 17 00:00:00 2001
From: Yong Tang
Date: Tue, 3 Jul 2018 12:32:35 +0000
Subject: [PATCH 071/519] Additional fix
Signed-off-by: Yong Tang
---
tensorflow/contrib/learn/python/learn/estimators/head.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tensorflow/contrib/learn/python/learn/estimators/head.py b/tensorflow/contrib/learn/python/learn/estimators/head.py
index dee0755204..e9c79f88b0 100644
--- a/tensorflow/contrib/learn/python/learn/estimators/head.py
+++ b/tensorflow/contrib/learn/python/learn/estimators/head.py
@@ -579,10 +579,10 @@ def _poisson_loss(labels, logits, weights=None):
labels = ops.convert_to_tensor(labels)
# To prevent broadcasting inside "-".
if len(labels.get_shape()) == 1:
- labels = array_ops.expand_dims(labels, dim=(1,))
+ labels = array_ops.expand_dims(labels, axis=(1,))
# TODO(zakaria): make sure it does not recreate the broadcast bug.
if len(logits.get_shape()) == 1:
- logits = array_ops.expand_dims(logits, dim=(1,))
+ logits = array_ops.expand_dims(logits, axis=(1,))
logits.get_shape().assert_is_compatible_with(labels.get_shape())
loss = nn.log_poisson_loss(labels, logits, compute_full_loss=True,
name=name)
--
GitLab
From a77a9689198675f62ced41eb5c737eec429b8fae Mon Sep 17 00:00:00 2001
From: Yong Tang
Date: Tue, 3 Jul 2018 12:33:58 +0000
Subject: [PATCH 072/519] Fix warning in _log_loss_with_two_classes as well
Signed-off-by: Yong Tang
---
tensorflow/contrib/learn/python/learn/estimators/head.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tensorflow/contrib/learn/python/learn/estimators/head.py b/tensorflow/contrib/learn/python/learn/estimators/head.py
index e9c79f88b0..ded93d4a7f 100644
--- a/tensorflow/contrib/learn/python/learn/estimators/head.py
+++ b/tensorflow/contrib/learn/python/learn/estimators/head.py
@@ -797,7 +797,7 @@ def _log_loss_with_two_classes(labels, logits, weights=None):
# TODO(ptucker): This will break for dynamic shapes.
# sigmoid_cross_entropy_with_logits requires [batch_size, 1] labels.
if len(labels.get_shape()) == 1:
- labels = array_ops.expand_dims(labels, dim=(1,))
+ labels = array_ops.expand_dims(labels, axis=(1,))
loss = nn.sigmoid_cross_entropy_with_logits(labels=labels, logits=logits,
name=name)
return _compute_weighted_loss(loss, weights)
--
GitLab
From 486b96a51d6b0b394edf77d182f7283a8ec03e0d Mon Sep 17 00:00:00 2001
From: Billy Lamberta
Date: Tue, 3 Jul 2018 16:17:58 -0700
Subject: [PATCH 073/519] Update eager notebooks in 1.9 to match master
---
.../nmt_with_attention.ipynb | 909 ++++++++++++++++++
.../examples/notebooks/2_gradients.ipynb | 323 -------
.../examples/notebooks/3_datasets.ipynb | 209 ----
.../notebooks/3_training_models.ipynb | 485 ----------
.../examples/notebooks/4_high_level.ipynb | 551 -----------
.../eager/python/examples/notebooks/README.md | 11 +
.../notebooks/automatic_differentiation.ipynb | 364 +++++++
.../examples/notebooks/custom_layers.ipynb | 399 ++++++++
.../examples/notebooks/custom_training.ipynb | 478 +++++++++
.../{1_basics.ipynb => eager_basics.ipynb} | 502 +++++-----
10 files changed, 2443 insertions(+), 1788 deletions(-)
create mode 100644 tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb
delete mode 100644 tensorflow/contrib/eager/python/examples/notebooks/2_gradients.ipynb
delete mode 100644 tensorflow/contrib/eager/python/examples/notebooks/3_datasets.ipynb
delete mode 100644 tensorflow/contrib/eager/python/examples/notebooks/3_training_models.ipynb
delete mode 100644 tensorflow/contrib/eager/python/examples/notebooks/4_high_level.ipynb
create mode 100644 tensorflow/contrib/eager/python/examples/notebooks/README.md
create mode 100644 tensorflow/contrib/eager/python/examples/notebooks/automatic_differentiation.ipynb
create mode 100644 tensorflow/contrib/eager/python/examples/notebooks/custom_layers.ipynb
create mode 100644 tensorflow/contrib/eager/python/examples/notebooks/custom_training.ipynb
rename tensorflow/contrib/eager/python/examples/notebooks/{1_basics.ipynb => eager_basics.ipynb} (50%)
diff --git a/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb b/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb
new file mode 100644
index 0000000000..34ce5e0cc3
--- /dev/null
+++ b/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb
@@ -0,0 +1,909 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "name": "nmt_with_attention.ipynb",
+ "version": "0.3.2",
+ "views": {},
+ "default_view": {},
+ "provenance": [
+ {
+ "file_id": "1C4fpM7_7IL8ZzF7Gc5abywqQjeQNS2-U",
+ "timestamp": 1527858391290
+ },
+ {
+ "file_id": "1pExo6aUuw0S6MISFWoinfJv0Ftm9V4qv",
+ "timestamp": 1527776041613
+ }
+ ],
+ "private_outputs": true,
+ "collapsed_sections": [],
+ "toc_visible": true
+ },
+ "kernelspec": {
+ "name": "python3",
+ "display_name": "Python 3"
+ },
+ "accelerator": "GPU"
+ },
+ "cells": [
+ {
+ "metadata": {
+ "id": "AOpGoE2T-YXS",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "##### Copyright 2018 The TensorFlow Authors.\n",
+ "\n",
+ "Licensed under the Apache License, Version 2.0 (the \"License\").\n",
+ "\n",
+ "# Neural Machine Translation with Attention\n",
+ "\n",
+ ""
+ ]
+ },
+ {
+ "metadata": {
+ "id": "CiwtNgENbx2g",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "This notebook trains a sequence to sequence (seq2seq) model for Spanish to English translation using [tf.keras](https://www.tensorflow.org/programmers_guide/keras) and [eager execution](https://www.tensorflow.org/programmers_guide/eager). This is an advanced example that assumes some knowledge of sequence to sequence models.\n",
+ "\n",
+ "After training the model in this notebook, you will be able to input a Spanish sentence, such as *\"¿todavia estan en casa?\"*, and return the English translation: *\"are you still at home?\"*\n",
+ "\n",
+ "The translation quality is reasonable for a toy example, but the generated attention plot is perhaps more interesting. This shows which parts of the input sentence has the model's attention while translating:\n",
+ "\n",
+ "
\n",
+ "\n",
+ "Note: This example takes approximately 10 mintues to run on a single P100 GPU."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "tnxXKDjq3jEL",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "from __future__ import absolute_import, division, print_function\n",
+ "\n",
+ "# Import TensorFlow >= 1.9 and enable eager execution\n",
+ "import tensorflow as tf\n",
+ "\n",
+ "tf.enable_eager_execution()\n",
+ "\n",
+ "import matplotlib.pyplot as plt\n",
+ "from sklearn.model_selection import train_test_split\n",
+ "\n",
+ "import unicodedata\n",
+ "import re\n",
+ "import numpy as np\n",
+ "import os\n",
+ "import time\n",
+ "\n",
+ "print(tf.__version__)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "wfodePkj3jEa",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Download and prepare the dataset\n",
+ "\n",
+ "We'll use a language dataset provided by http://www.manythings.org/anki/. This dataset contains language translation pairs in the format:\n",
+ "\n",
+ "```\n",
+ "May I borrow this book?\t¿Puedo tomar prestado este libro?\n",
+ "```\n",
+ "\n",
+ "There are a variety of languages available, but we'll use the English-Spanish dataset. For convenience, we've hosted a copy of this dataset on Google Cloud, but you can also download your own copy. After downloading the dataset, here are the steps we'll take to prepare the data:\n",
+ "\n",
+ "1. Add a *start* and *end* token to each sentence.\n",
+ "2. Clean the sentences by removing special characters.\n",
+ "3. Create a word index and reverse word index (dictionaries mapping from word → id and id → word).\n",
+ "4. Pad each sentence to a maximum length."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "kRVATYOgJs1b",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "# Download the file\n",
+ "path_to_zip = tf.keras.utils.get_file(\n",
+ " 'spa-eng.zip', origin='http://download.tensorflow.org/data/spa-eng.zip', \n",
+ " extract=True)\n",
+ "\n",
+ "path_to_file = os.path.dirname(path_to_zip)+\"/spa-eng/spa.txt\""
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "rd0jw-eC3jEh",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "# Converts the unicode file to ascii\n",
+ "def unicode_to_ascii(s):\n",
+ " return ''.join(c for c in unicodedata.normalize('NFD', s)\n",
+ " if unicodedata.category(c) != 'Mn')\n",
+ "\n",
+ "\n",
+ "def preprocess_sentence(w):\n",
+ " w = unicode_to_ascii(w.lower().strip())\n",
+ " \n",
+ " # creating a space between a word and the punctuation following it\n",
+ " # eg: \"he is a boy.\" => \"he is a boy .\" \n",
+ " # Reference:- https://stackoverflow.com/questions/3645931/python-padding-punctuation-with-white-spaces-keeping-punctuation\n",
+ " w = re.sub(r\"([?.!,¿])\", r\" \\1 \", w)\n",
+ " w = re.sub(r'[\" \"]+', \" \", w)\n",
+ " \n",
+ " # replacing everything with space except (a-z, A-Z, \".\", \"?\", \"!\", \",\")\n",
+ " w = re.sub(r\"[^a-zA-Z?.!,¿]+\", \" \", w)\n",
+ " \n",
+ " w = w.rstrip().strip()\n",
+ " \n",
+ " # adding a start and an end token to the sentence\n",
+ " # so that the model know when to start and stop predicting.\n",
+ " w = ' ' + w + ' '\n",
+ " return w"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "OHn4Dct23jEm",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "# 1. Remove the accents\n",
+ "# 2. Clean the sentences\n",
+ "# 3. Return word pairs in the format: [ENGLISH, SPANISH]\n",
+ "def create_dataset(path, num_examples):\n",
+ " lines = open(path, encoding='UTF-8').read().strip().split('\\n')\n",
+ " \n",
+ " word_pairs = [[preprocess_sentence(w) for w in l.split('\\t')] for l in lines[:num_examples]]\n",
+ " \n",
+ " return word_pairs"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "9xbqO7Iie9bb",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "# This class creates a word -> index mapping (e.g,. \"dad\" -> 5) and vice-versa \n",
+ "# (e.g., 5 -> \"dad\") for each language,\n",
+ "class LanguageIndex():\n",
+ " def __init__(self, lang):\n",
+ " self.lang = lang\n",
+ " self.word2idx = {}\n",
+ " self.idx2word = {}\n",
+ " self.vocab = set()\n",
+ " \n",
+ " self.create_index()\n",
+ " \n",
+ " def create_index(self):\n",
+ " for phrase in self.lang:\n",
+ " self.vocab.update(phrase.split(' '))\n",
+ " \n",
+ " self.vocab = sorted(self.vocab)\n",
+ " \n",
+ " self.word2idx[''] = 0\n",
+ " for index, word in enumerate(self.vocab):\n",
+ " self.word2idx[word] = index + 1\n",
+ " \n",
+ " for word, index in self.word2idx.items():\n",
+ " self.idx2word[index] = word"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "eAY9k49G3jE_",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "def max_length(tensor):\n",
+ " return max(len(t) for t in tensor)\n",
+ "\n",
+ "\n",
+ "def load_dataset(path, num_examples):\n",
+ " # creating cleaned input, output pairs\n",
+ " pairs = create_dataset(path, num_examples)\n",
+ "\n",
+ " # index language using the class defined above \n",
+ " inp_lang = LanguageIndex(sp for en, sp in pairs)\n",
+ " targ_lang = LanguageIndex(en for en, sp in pairs)\n",
+ " \n",
+ " # Vectorize the input and target languages\n",
+ " \n",
+ " # Spanish sentences\n",
+ " input_tensor = [[inp_lang.word2idx[s] for s in sp.split(' ')] for en, sp in pairs]\n",
+ " \n",
+ " # English sentences\n",
+ " target_tensor = [[targ_lang.word2idx[s] for s in en.split(' ')] for en, sp in pairs]\n",
+ " \n",
+ " # Calculate max_length of input and output tensor\n",
+ " # Here, we'll set those to the longest sentence in the dataset\n",
+ " max_length_inp, max_length_tar = max_length(input_tensor), max_length(target_tensor)\n",
+ " \n",
+ " # Padding the input and output tensor to the maximum length\n",
+ " input_tensor = tf.keras.preprocessing.sequence.pad_sequences(input_tensor, \n",
+ " maxlen=max_length_inp,\n",
+ " padding='post')\n",
+ " \n",
+ " target_tensor = tf.keras.preprocessing.sequence.pad_sequences(target_tensor, \n",
+ " maxlen=max_length_tar, \n",
+ " padding='post')\n",
+ " \n",
+ " return input_tensor, target_tensor, inp_lang, targ_lang, max_length_inp, max_length_tar"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "GOi42V79Ydlr",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "### Limit the size of the dataset to experiment faster (optional)\n",
+ "\n",
+ "Training on the complete dataset of >100,000 sentences will take a long time. To train faster, we can limit the size of the dataset to 30,000 sentences (of course, translation quality degrades with less data):"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "cnxC7q-j3jFD",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "# Try experimenting with the size of that dataset\n",
+ "num_examples = 30000\n",
+ "input_tensor, target_tensor, inp_lang, targ_lang, max_length_inp, max_length_targ = load_dataset(path_to_file, num_examples)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "4QILQkOs3jFG",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "# Creating training and validation sets using an 80-20 split\n",
+ "input_tensor_train, input_tensor_val, target_tensor_train, target_tensor_val = train_test_split(input_tensor, target_tensor, test_size=0.2)\n",
+ "\n",
+ "# Show length\n",
+ "len(input_tensor_train), len(target_tensor_train), len(input_tensor_val), len(target_tensor_val)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "rgCLkfv5uO3d",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "### Create a tf.data dataset"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "TqHsArVZ3jFS",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "BUFFER_SIZE = len(input_tensor_train)\n",
+ "BATCH_SIZE = 64\n",
+ "embedding_dim = 256\n",
+ "units = 1024\n",
+ "vocab_inp_size = len(inp_lang.word2idx)\n",
+ "vocab_tar_size = len(targ_lang.word2idx)\n",
+ "\n",
+ "dataset = tf.data.Dataset.from_tensor_slices((input_tensor_train, target_tensor_train)).shuffle(BUFFER_SIZE)\n",
+ "dataset = dataset.apply(tf.contrib.data.batch_and_drop_remainder(BATCH_SIZE))"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "TNfHIF71ulLu",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Write the encoder and decoder model\n",
+ "\n",
+ "Here, we'll implement an encoder-decoder model with attention which you can read about in the TensorFlow [Neural Machine Translation (seq2seq) tutorial](https://www.tensorflow.org/tutorials/seq2seq). This example uses a more recent set of APIs. This notebook implements the [attention equations](https://www.tensorflow.org/tutorials/seq2seq#background_on_the_attention_mechanism) from the seq2seq tutorial. The following diagram shows that each input words is assigned a weight by the attention mechanism which is then used by the decoder to predict the next word in the sentence.\n",
+ "\n",
+ "
\n",
+ "\n",
+ "The input is put through an encoder model which gives us the encoder output of shape *(batch_size, max_length, hidden_size)* and the encoder hidden state of shape *(batch_size, hidden_size)*. \n",
+ "\n",
+ "Here are the equations that are implemented:\n",
+ "\n",
+ "
\n",
+ "
\n",
+ "\n",
+ "We're using *Bahdanau attention*. Lets decide on notation before writing the simplified form:\n",
+ "\n",
+ "* FC = Fully connected (dense) layer\n",
+ "* EO = Encoder output\n",
+ "* H = hidden state\n",
+ "* X = input to the decoder\n",
+ "\n",
+ "And the pseudo-code:\n",
+ "\n",
+ "* `score = FC(tanh(FC(EO) + FC(H)))`\n",
+ "* `attention weights = softmax(score, axis = 1)`. Softmax by default is applied on the last axis but here we want to apply it on the *1st axis*, since the shape of score is *(batch_size, max_length, hidden_size)*. `Max_length` is the length of our input. Since we are trying to assign a weight to each input, softmax should be applied on that axis.\n",
+ "* `context vector = sum(attention weights * EO, axis = 1)`. Same reason as above for choosing axis as 1.\n",
+ "* `embedding output` = The input to the decoder X is passed through an embedding layer.\n",
+ "* `merged vector = concat(embedding output, context vector)`\n",
+ "* This merged vector is then given to the GRU\n",
+ " \n",
+ "The shapes of all the vectors at each step have been specified in the comments in the code:"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "avyJ_4VIUoHb",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "def gru(units):\n",
+ " # If you have a GPU, we recommend using CuDNNGRU(provides a 3x speedup than GRU)\n",
+ " # the code automatically does that.\n",
+ " if tf.test.is_gpu_available():\n",
+ " return tf.keras.layers.CuDNNGRU(units, \n",
+ " return_sequences=True, \n",
+ " return_state=True, \n",
+ " recurrent_initializer='glorot_uniform')\n",
+ " else:\n",
+ " return tf.keras.layers.GRU(units, \n",
+ " return_sequences=True, \n",
+ " return_state=True, \n",
+ " recurrent_activation='sigmoid', \n",
+ " recurrent_initializer='glorot_uniform')"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "nZ2rI24i3jFg",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "class Encoder(tf.keras.Model):\n",
+ " def __init__(self, vocab_size, embedding_dim, enc_units, batch_sz):\n",
+ " super(Encoder, self).__init__()\n",
+ " self.batch_sz = batch_sz\n",
+ " self.enc_units = enc_units\n",
+ " self.embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim)\n",
+ " self.gru = gru(self.enc_units)\n",
+ " \n",
+ " def call(self, x, hidden):\n",
+ " x = self.embedding(x)\n",
+ " output, state = self.gru(x, initial_state = hidden) \n",
+ " return output, state\n",
+ " \n",
+ " def initialize_hidden_state(self):\n",
+ " return tf.zeros((self.batch_sz, self.enc_units))"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "yJ_B3mhW3jFk",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "class Decoder(tf.keras.Model):\n",
+ " def __init__(self, vocab_size, embedding_dim, dec_units, batch_sz):\n",
+ " super(Decoder, self).__init__()\n",
+ " self.batch_sz = batch_sz\n",
+ " self.dec_units = dec_units\n",
+ " self.embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim)\n",
+ " self.gru = gru(self.dec_units)\n",
+ " self.fc = tf.keras.layers.Dense(vocab_size)\n",
+ " \n",
+ " # used for attention\n",
+ " self.W1 = tf.keras.layers.Dense(self.dec_units)\n",
+ " self.W2 = tf.keras.layers.Dense(self.dec_units)\n",
+ " self.V = tf.keras.layers.Dense(1)\n",
+ " \n",
+ " def call(self, x, hidden, enc_output):\n",
+ " # enc_output shape == (batch_size, max_length, hidden_size)\n",
+ " \n",
+ " # hidden shape == (batch_size, hidden size)\n",
+ " # hidden_with_time_axis shape == (batch_size, 1, hidden size)\n",
+ " # we are doing this to perform addition to calculate the score\n",
+ " hidden_with_time_axis = tf.expand_dims(hidden, 1)\n",
+ " \n",
+ " # score shape == (batch_size, max_length, hidden_size)\n",
+ " score = tf.nn.tanh(self.W1(enc_output) + self.W2(hidden_with_time_axis))\n",
+ " \n",
+ " # attention_weights shape == (batch_size, max_length, 1)\n",
+ " # we get 1 at the last axis because we are applying score to self.V\n",
+ " attention_weights = tf.nn.softmax(self.V(score), axis=1)\n",
+ " \n",
+ " # context_vector shape after sum == (batch_size, hidden_size)\n",
+ " context_vector = attention_weights * enc_output\n",
+ " context_vector = tf.reduce_sum(context_vector, axis=1)\n",
+ " \n",
+ " # x shape after passing through embedding == (batch_size, 1, embedding_dim)\n",
+ " x = self.embedding(x)\n",
+ " \n",
+ " # x shape after concatenation == (batch_size, 1, embedding_dim + hidden_size)\n",
+ " x = tf.concat([tf.expand_dims(context_vector, 1), x], axis=-1)\n",
+ " \n",
+ " # passing the concatenated vector to the GRU\n",
+ " output, state = self.gru(x)\n",
+ " \n",
+ " # output shape == (batch_size * max_length, hidden_size)\n",
+ " output = tf.reshape(output, (-1, output.shape[2]))\n",
+ " \n",
+ " # output shape == (batch_size * max_length, vocab)\n",
+ " x = self.fc(output)\n",
+ " \n",
+ " return x, state, attention_weights\n",
+ " \n",
+ " def initialize_hidden_state(self):\n",
+ " return tf.zeros((self.batch_sz, self.dec_units))"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "P5UY8wko3jFp",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "encoder = Encoder(vocab_inp_size, embedding_dim, units, BATCH_SIZE)\n",
+ "decoder = Decoder(vocab_tar_size, embedding_dim, units, BATCH_SIZE)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "_ch_71VbIRfK",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Define the optimizer and the loss function"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "WmTHr5iV3jFr",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "optimizer = tf.train.AdamOptimizer()\n",
+ "\n",
+ "\n",
+ "def loss_function(real, pred):\n",
+ " mask = 1 - np.equal(real, 0)\n",
+ " loss_ = tf.nn.sparse_softmax_cross_entropy_with_logits(labels=real, logits=pred) * mask\n",
+ " return tf.reduce_mean(loss_)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "hpObfY22IddU",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Training\n",
+ "\n",
+ "1. Pass the *input* through the *encoder* which return *encoder output* and the *encoder hidden state*.\n",
+ "2. The encoder output, encoder hidden state and the decoder input (which is the *start token*) is passed to the decoder.\n",
+ "3. The decoder returns the *predictions* and the *decoder hidden state*.\n",
+ "4. The decoder hidden state is then passed back into the model and the predictions are used to calculate the loss.\n",
+ "5. Use *teacher forcing* to decide the next input to the decoder.\n",
+ "6. *Teacher forcing* is the technique where the *target word* is passed as the *next input* to the decoder.\n",
+ "7. The final step is to calculate the gradients and apply it to the optimizer and backpropagate."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "ddefjBMa3jF0",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "EPOCHS = 10\n",
+ "\n",
+ "for epoch in range(EPOCHS):\n",
+ " start = time.time()\n",
+ " \n",
+ " hidden = encoder.initialize_hidden_state()\n",
+ " total_loss = 0\n",
+ " \n",
+ " for (batch, (inp, targ)) in enumerate(dataset):\n",
+ " loss = 0\n",
+ " \n",
+ " with tf.GradientTape() as tape:\n",
+ " enc_output, enc_hidden = encoder(inp, hidden)\n",
+ " \n",
+ " dec_hidden = enc_hidden\n",
+ " \n",
+ " dec_input = tf.expand_dims([targ_lang.word2idx['']] * BATCH_SIZE, 1) \n",
+ " \n",
+ " # Teacher forcing - feeding the target as the next input\n",
+ " for t in range(1, targ.shape[1]):\n",
+ " # passing enc_output to the decoder\n",
+ " predictions, dec_hidden, _ = decoder(dec_input, dec_hidden, enc_output)\n",
+ " \n",
+ " loss += loss_function(targ[:, t], predictions)\n",
+ " \n",
+ " # using teacher forcing\n",
+ " dec_input = tf.expand_dims(targ[:, t], 1)\n",
+ " \n",
+ " total_loss += (loss / int(targ.shape[1]))\n",
+ " \n",
+ " variables = encoder.variables + decoder.variables\n",
+ " \n",
+ " gradients = tape.gradient(loss, variables)\n",
+ " \n",
+ " optimizer.apply_gradients(zip(gradients, variables), tf.train.get_or_create_global_step())\n",
+ "\n",
+ " if batch % 100 == 0:\n",
+ " print('Epoch {} Batch {} Loss {:.4f}'.format(epoch + 1,\n",
+ " batch,\n",
+ " loss.numpy() / int(targ.shape[1])))\n",
+ " \n",
+ " print('Epoch {} Loss {:.4f}'.format(epoch + 1,\n",
+ " total_loss/len(input_tensor)))\n",
+ " print('Time taken for 1 epoch {} sec\\n'.format(time.time() - start))"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "mU3Ce8M6I3rz",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Translate\n",
+ "\n",
+ "* The evaluate function is similar to the training loop, except we don't use *teacher forcing* here. The input to the decoder at each time step is its previous predictions along with the hidden state and the encoder output.\n",
+ "* Stop predicting when the model predicts the *end token*.\n",
+ "* And store the *attention weights for every time step*.\n",
+ "\n",
+ "Note: The encoder output is calculated only once for one input."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "EbQpyYs13jF_",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "def evaluate(sentence, encoder, decoder, inp_lang, targ_lang, max_length_inp, max_length_targ):\n",
+ " attention_plot = np.zeros((max_length_targ, max_length_inp))\n",
+ " \n",
+ " sentence = preprocess_sentence(sentence)\n",
+ "\n",
+ " inputs = [inp_lang.word2idx[i] for i in sentence.split(' ')]\n",
+ " inputs = tf.keras.preprocessing.sequence.pad_sequences([inputs], maxlen=max_length_inp, padding='post')\n",
+ " inputs = tf.convert_to_tensor(inputs)\n",
+ " \n",
+ " result = ''\n",
+ "\n",
+ " hidden = [tf.zeros((1, units))]\n",
+ " enc_out, enc_hidden = encoder(inputs, hidden)\n",
+ "\n",
+ " dec_hidden = enc_hidden\n",
+ " dec_input = tf.expand_dims([targ_lang.word2idx['']], 0)\n",
+ "\n",
+ " for t in range(max_length_targ):\n",
+ " predictions, dec_hidden, attention_weights = decoder(dec_input, dec_hidden, enc_out)\n",
+ " \n",
+ " # storing the attention weigths to plot later on\n",
+ " attention_weights = tf.reshape(attention_weights, (-1, ))\n",
+ " attention_plot[t] = attention_weights.numpy()\n",
+ "\n",
+ " predicted_id = tf.multinomial(tf.exp(predictions), num_samples=1)[0][0].numpy()\n",
+ "\n",
+ " result += targ_lang.idx2word[predicted_id] + ' '\n",
+ "\n",
+ " if targ_lang.idx2word[predicted_id] == '':\n",
+ " return result, sentence, attention_plot\n",
+ " \n",
+ " # the predicted ID is fed back into the model\n",
+ " dec_input = tf.expand_dims([predicted_id], 0)\n",
+ "\n",
+ " return result, sentence, attention_plot"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "s5hQWlbN3jGF",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "# function for plotting the attention weights\n",
+ "def plot_attention(attention, sentence, predicted_sentence):\n",
+ " fig = plt.figure(figsize=(10,10))\n",
+ " ax = fig.add_subplot(1, 1, 1)\n",
+ " ax.matshow(attention, cmap='viridis')\n",
+ " \n",
+ " fontdict = {'fontsize': 14}\n",
+ " \n",
+ " ax.set_xticklabels([''] + sentence, fontdict=fontdict, rotation=90)\n",
+ " ax.set_yticklabels([''] + predicted_sentence, fontdict=fontdict)\n",
+ "\n",
+ " plt.show()"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "sl9zUHzg3jGI",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "def translate(sentence, encoder, decoder, inp_lang, targ_lang, max_length_inp, max_length_targ):\n",
+ " result, sentence, attention_plot = evaluate(sentence, encoder, decoder, inp_lang, targ_lang, max_length_inp, max_length_targ)\n",
+ " \n",
+ " print('Input: {}'.format(sentence))\n",
+ " print('Predicted translation: {}'.format(result))\n",
+ " \n",
+ " attention_plot = attention_plot[:len(result.split(' ')), :len(sentence.split(' '))]\n",
+ " plot_attention(attention_plot, sentence.split(' '), result.split(' '))"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "WrAM0FDomq3E",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "translate('hace mucho frio aqui.', encoder, decoder, inp_lang, targ_lang, max_length_inp, max_length_targ)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "zSx2iM36EZQZ",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "translate('esta es mi vida.', encoder, decoder, inp_lang, targ_lang, max_length_inp, max_length_targ)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "A3LLCx3ZE0Ls",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "translate('¿todavia estan en casa?', encoder, decoder, inp_lang, targ_lang, max_length_inp, max_length_targ)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "DUQVLVqUE1YW",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "# wrong translation\n",
+ "translate('trata de averiguarlo.', encoder, decoder, inp_lang, targ_lang, max_length_inp, max_length_targ)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "RTe5P5ioMJwN",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Next steps\n",
+ "\n",
+ "* [Download a different dataset](http://www.manythings.org/anki/) to experiment with translations, for example, English to German, or English to French.\n",
+ "* Experiment with training on a larger dataset, or using more epochs\n"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/tensorflow/contrib/eager/python/examples/notebooks/2_gradients.ipynb b/tensorflow/contrib/eager/python/examples/notebooks/2_gradients.ipynb
deleted file mode 100644
index 9c1af9c208..0000000000
--- a/tensorflow/contrib/eager/python/examples/notebooks/2_gradients.ipynb
+++ /dev/null
@@ -1,323 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "vDJ4XzMqodTy"
- },
- "source": [
- "# Automatic Differentiation\n",
- "\n",
- "In the previous tutorial we introduced `Tensor`s and operations on them. In this tutorial we will cover [automatic differentiation](https://en.wikipedia.org/wiki/Automatic_differentiation), a key technique for optimizing machine learning models."
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "GQJysDM__Qb0"
- },
- "source": [
- "## Setup\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "OiMPZStlibBv"
- },
- "outputs": [],
- "source": [
- "import tensorflow as tf\n",
- "tf.enable_eager_execution()\n",
- "\n",
- "tfe = tf.contrib.eager # Shorthand for some symbols"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "1CLWJl0QliB0"
- },
- "source": [
- "## Derivatives of a function\n",
- "\n",
- "TensorFlow provides APIs for automatic differentiation - computing the derivative of a function. The way that more closely mimics the math is to encapsulate the computation in a Python function, say `f`, and use `tfe.gradients_function` to create a function that computes the derivatives of `f` with respect to its arguments. If you're familiar with [autograd](https://github.com/HIPS/autograd) for differentiating numpy functions, this will be familiar. For example: "
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "9FViq92UX7P8"
- },
- "outputs": [],
- "source": [
- "from math import pi\n",
- "\n",
- "def f(x):\n",
- " return tf.square(tf.sin(x))\n",
- "\n",
- "assert f(pi/2).numpy() == 1.0\n",
- "\n",
- "\n",
- "# grad_f will return a list of derivatives of f\n",
- "# with respect to its arguments. Since f() has a single argument,\n",
- "# grad_f will return a list with a single element.\n",
- "grad_f = tfe.gradients_function(f)\n",
- "assert tf.abs(grad_f(pi/2)[0]).numpy() \u003c 1e-7"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "v9fPs8RyopCf"
- },
- "source": [
- "### Higher-order gradients\n",
- "\n",
- "The same API can be used to differentiate as many times as you like:\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- },
- "height": 276
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 730,
- "status": "ok",
- "timestamp": 1527005655565,
- "user": {
- "displayName": "",
- "photoUrl": "",
- "userId": ""
- },
- "user_tz": 420
- },
- "id": "3D0ZvnGYo0rW",
- "outputId": "e23f8cc6-6813-4944-f20f-825b8a03c2ff"
- },
- "outputs": [
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAEDCAYAAAAhsS8XAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzsnXd0HNX5sJ/ZXrTq3ZLV3IvcDdgGGwOm2WCbHhJa6C2B\nUBISQioBfoQPkjhACA4QCIQSDITQbGMbsHHvVbZ6s7q0vc18f4xmJVltJa0q+5zDOXhn9s7dqzvv\nf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xEmkwlxcXGi44xjs9kQHx+PlJQU3LlzR3ScoDweD3p6enD48GEolUocO3YMdXV1\nMBqNoqONMzIyAqvVips3b2LGjBkwGo1oamoK/fn55BtEQSxZsmTcePHixYKShFZUVEQdHR3+sUaj\noZcvXwpMNN7Dhw8pMzOT1Go1qVQqSk1NJZVKRUNDQ6KjTejKlStUWFjo3y8MF/fv3yeDweAfm81m\nMpvNAhMF53a7yWAwUENDg+goEzp58iStWLGC1Go1ZWVlUUZGBu3bt090rADPnz8ntVrtH9+9ezcs\n/w+4du0alZeX+8cWi4WOHj0aco6wPXaFQoGOjg4AQFtbGxYsWCAqSkgajQZtbW0AgL6+Png8Hsjl\ncsGp/pCcnIzW1lZYrVbcuHEDCoUCFoslLBuxNTc348yZM6itrUV0dHgdvKBUKvHkyRM8ffoULpcL\nV69exapVq0THmpDJZMLChQuxbds20VEmtGfPHthsNlitVpw6dQrLli1DdXW16FgB4uPjkZCQgL6+\nPgBAe3s7kpKSBKcKNHfuXHR1dWFsbAxE9EE5he2xV1RUoLKyEj6fDzExMaioqBAVJaQNGzbAZDJB\np9NBJpOhqqpKdKSQwrlnT2VlJdxuNwwGAwAgPT0dR44cERvqf6KionDo0CEYDAYQEQoKCsLyQ37v\n3j00NTUhOTkZ+fn5kEgkKCkpwfLly0VHm5QOHjyIvXv3wuPxIDExEcePHxcdKUBaWhqys7ORn58P\nqVSK1NRUbN68OeQc7hXDGGMRhu88ZYyxCMOFnTHGIgwXdsYYizBc2BljLMJwYWeMsQjDhZ0xxiIM\nF3bGGIswXNgZYyzC/Be68EGj7hfMcwAAAABJRU5ErkJggg==\n",
- "text/plain": [
- "\u003cmatplotlib.figure.Figure at 0x7f385e198650\u003e"
- ]
- },
- "metadata": {
- "tags": []
- },
- "output_type": "display_data"
- }
- ],
- "source": [
- "def f(x):\n",
- " return tf.square(tf.sin(x))\n",
- "\n",
- "def grad(f):\n",
- " return lambda x: tfe.gradients_function(f)(x)[0]\n",
- "\n",
- "x = tf.lin_space(-2*pi, 2*pi, 100) # 100 points between -2π and +2π\n",
- "\n",
- "import matplotlib.pyplot as plt\n",
- "\n",
- "plt.plot(x, f(x), label=\"f\")\n",
- "plt.plot(x, grad(f)(x), label=\"first derivative\")\n",
- "plt.plot(x, grad(grad(f))(x), label=\"second derivative\")\n",
- "plt.plot(x, grad(grad(grad(f)))(x), label=\"third derivative\")\n",
- "plt.legend()\n",
- "plt.show()"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "-39gouo7mtgu"
- },
- "source": [
- "## Gradient tapes\n",
- "\n",
- "Every differentiable TensorFlow operation has an associated gradient function. For example, the gradient function of `tf.square(x)` would be a function that returns `2.0 * x`. To compute the gradient of a user-defined function (like `f(x)` in the example above), TensorFlow first \"records\" all the operations applied to compute the output of the function. We call this record a \"tape\". It then uses that tape and the gradients functions associated with each primitive operation to compute the gradients of the user-defined function using [reverse mode differentiation](https://en.wikipedia.org/wiki/Automatic_differentiation).\n",
- "\n",
- "Since operations are recorded as they are executed, Python control flow (using `if`s and `while`s for example) is naturally handled:\n",
- "\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "MH0UfjympWf7"
- },
- "outputs": [],
- "source": [
- "def f(x, y):\n",
- " output = 1\n",
- " for i in range(y):\n",
- " output = tf.multiply(output, x)\n",
- " return output\n",
- "\n",
- "def g(x, y):\n",
- " # Return the gradient of `f` with respect to it's first parameter\n",
- " return tfe.gradients_function(f)(x, y)[0]\n",
- "\n",
- "assert f(3.0, 2).numpy() == 9.0 # f(x, 2) is essentially x * x\n",
- "assert g(3.0, 2).numpy() == 6.0 # And its gradient will be 2 * x\n",
- "assert f(4.0, 3).numpy() == 64.0 # f(x, 3) is essentially x * x * x\n",
- "assert g(4.0, 3).numpy() == 48.0 # And its gradient will be 3 * x * x"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "aNmR5-jhpX2t"
- },
- "source": [
- "At times it may be inconvenient to encapsulate computation of interest into a function. For example, if you want the gradient of the output with respect to intermediate values computed in the function. In such cases, the slightly more verbose but explicit [tf.GradientTape](https://www.tensorflow.org/api_docs/python/tf/GradientTape) context is useful. All computation inside the context of a `tf.GradientTape` is \"recorded\".\n",
- "\n",
- "For example:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "bAFeIE8EuVIq"
- },
- "outputs": [],
- "source": [
- "x = tf.ones((2, 2))\n",
- " \n",
- "# TODO(b/78880779): Remove the 'persistent=True' argument and use\n",
- "# a single t.gradient() call when the bug is resolved.\n",
- "with tf.GradientTape(persistent=True) as t:\n",
- " # TODO(ashankar): Explain with \"watch\" argument better?\n",
- " t.watch(x)\n",
- " y = tf.reduce_sum(x)\n",
- " z = tf.multiply(y, y)\n",
- "\n",
- "# Use the same tape to compute the derivative of z with respect to the\n",
- "# intermediate value y.\n",
- "dz_dy = t.gradient(z, y)\n",
- "assert dz_dy.numpy() == 8.0\n",
- "\n",
- "# Derivative of z with respect to the original input tensor x\n",
- "dz_dx = t.gradient(z, x)\n",
- "for i in [0, 1]:\n",
- " for j in [0, 1]:\n",
- " assert dz_dx[i][j].numpy() == 8.0"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "DK05KXrAAld3"
- },
- "source": [
- "### Higher-order gradients\n",
- "\n",
- "Operations inside of the `GradientTape` context manager are recorded for automatic differentiation. If gradients are computed in that context, then the gradient computation is recorded as well. As a result, the exact same API works for higher-order gradients as well. For example:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "cPQgthZ7ugRJ"
- },
- "outputs": [],
- "source": [
- "# TODO(ashankar): Should we use the persistent tape here instead? Follow up on Tom and Alex's discussion\n",
- "\n",
- "x = tf.constant(1.0) # Convert the Python 1.0 to a Tensor object\n",
- "\n",
- "with tf.GradientTape() as t:\n",
- " with tf.GradientTape() as t2:\n",
- " t2.watch(x)\n",
- " y = x * x * x\n",
- " # Compute the gradient inside the 't' context manager\n",
- " # which means the gradient computation is differentiable as well.\n",
- " dy_dx = t2.gradient(y, x)\n",
- "d2y_dx2 = t.gradient(dy_dx, x)\n",
- "\n",
- "assert dy_dx.numpy() == 3.0\n",
- "assert d2y_dx2.numpy() == 6.0"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "4U1KKzUpNl58"
- },
- "source": [
- "## Next Steps\n",
- "\n",
- "In this tutorial we covered gradient computation in TensorFlow. With that we have enough of the primitives required to build an train neural networks, which we will cover in the [next tutorial](https://github.com/tensorflow/models/tree/master/official/contrib/eager/python/examples/notebooks/3_neural_networks.ipynb)."
- ]
- }
- ],
- "metadata": {
- "colab": {
- "collapsed_sections": [],
- "default_view": {},
- "name": "Automatic Differentiation",
- "provenance": [],
- "version": "0.3.2",
- "views": {}
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/tensorflow/contrib/eager/python/examples/notebooks/3_datasets.ipynb b/tensorflow/contrib/eager/python/examples/notebooks/3_datasets.ipynb
deleted file mode 100644
index d268cbcd91..0000000000
--- a/tensorflow/contrib/eager/python/examples/notebooks/3_datasets.ipynb
+++ /dev/null
@@ -1,209 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "U9i2Dsh-ziXr"
- },
- "source": [
- "# Eager Execution Tutorial: Importing Data\n",
- "\n",
- "This notebook demonstrates the use of the [`tf.data.Dataset` API](https://www.tensorflow.org/guide/datasets) to build pipelines to feed data to your program. It covers:\n",
- "\n",
- "* Creating a `Dataset`.\n",
- "* Iteration over a `Dataset` with eager execution enabled.\n",
- "\n",
- "We recommend using the `Dataset`s API for building performant, complex input pipelines from simple, re-usable pieces that will feed your model's training or evaluation loops.\n",
- "\n",
- "If you're familiar with TensorFlow graphs, the API for constructing the `Dataset` object remains exactly the same when eager execution is enabled, but the process of iterating over elements of the dataset is slightly simpler.\n",
- "You can use Python iteration over the `tf.data.Dataset` object and do not need to explicitly create an `tf.data.Iterator` object.\n",
- "As a result, the discussion on iterators in the [TensorFlow Guide](https://www.tensorflow.org/guide/datasets) is not relevant when eager execution is enabled."
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "z1JcS5iBXMRO"
- },
- "source": [
- "# Setup: Enable eager execution\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "cellView": "code",
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "RlIWhyeLoYnG"
- },
- "outputs": [],
- "source": [
- "# Import TensorFlow.\n",
- "import tensorflow as tf\n",
- "\n",
- "# Enable eager execution\n",
- "tf.enable_eager_execution()"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "H9UySOPLXdaw"
- },
- "source": [
- "# Step 1: Create a source `Dataset`\n",
- "\n",
- "Create a _source_ dataset using one of the factory functions like [`Dataset.from_tensors`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#from_tensors), [`Dataset.from_tensor_slices`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#from_tensor_slices) or using objects that read from files like [`TextLineDataset`](https://www.tensorflow.org/api_docs/python/tf/data/TextLineDataset) or [`TFRecordDataset`](https://www.tensorflow.org/api_docs/python/tf/data/TFRecordDataset). See the [TensorFlow Guide](https://www.tensorflow.org/guide/datasets#reading_input_data) for more information."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "cellView": "code",
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "WPTUfGq6kJ5w"
- },
- "outputs": [],
- "source": [
- "ds_tensors = tf.data.Dataset.from_tensor_slices([1, 2, 3, 4, 5, 6])\n",
- "\n",
- "# Create a CSV file\n",
- "import tempfile\n",
- "_, filename = tempfile.mkstemp()\n",
- "with open(filename, 'w') as f:\n",
- " f.write(\"\"\"Line 1\n",
- "Line 2\n",
- "Line 3\n",
- " \"\"\")\n",
- "ds_file = tf.data.TextLineDataset(filename)\n"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "twBfWd5xyu_d"
- },
- "source": [
- "# Step 2: Apply transformations\n",
- "\n",
- "Use the transformations functions like [`map`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#map), [`batch`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#batch), [`shuffle`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#shuffle) etc. to apply transformations to the records of the dataset. See the [API documentation for `tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset) for details."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "cellView": "code",
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "ngUe237Wt48W"
- },
- "outputs": [],
- "source": [
- "ds_tensors = ds_tensors.map(tf.square).shuffle(2).batch(2)\n",
- "ds_file = ds_file.batch(2)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "IDY4WsYRhP81"
- },
- "source": [
- "# Step 3: Iterate\n",
- "\n",
- "When eager execution is enabled `Dataset` objects support iteration.\n",
- "If you're familiar with the use of `Dataset`s in TensorFlow graphs, note that there is no need for calls to `Dataset.make_one_shot_iterator()` or `get_next()` calls."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- },
- "base_uri": "https://localhost:8080/",
- "height": 153
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 388,
- "status": "ok",
- "timestamp": 1525154629129,
- "user": {
- "displayName": "",
- "photoUrl": "",
- "userId": ""
- },
- "user_tz": 420
- },
- "id": "lCUWzso6mbqR",
- "outputId": "8e4b0298-d27d-4ac7-e26a-ef94af0594ec"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Elements of ds_tensors:\n",
- "tf.Tensor([1 9], shape=(2,), dtype=int32)\n",
- "tf.Tensor([16 25], shape=(2,), dtype=int32)\n",
- "tf.Tensor([ 4 36], shape=(2,), dtype=int32)\n",
- "\n",
- "Elements in ds_file:\n",
- "tf.Tensor(['Line 1' 'Line 2'], shape=(2,), dtype=string)\n",
- "tf.Tensor(['Line 3' ' '], shape=(2,), dtype=string)\n"
- ]
- }
- ],
- "source": [
- "print('Elements of ds_tensors:')\n",
- "for x in ds_tensors:\n",
- " print(x)\n",
- "\n",
- "print('\\nElements in ds_file:')\n",
- "for x in ds_file:\n",
- " print(x)"
- ]
- }
- ],
- "metadata": {
- "colab": {
- "collapsed_sections": [],
- "default_view": {},
- "name": "Eager Execution Tutorial: Importing Data",
- "provenance": [],
- "version": "0.3.2",
- "views": {}
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/tensorflow/contrib/eager/python/examples/notebooks/3_training_models.ipynb b/tensorflow/contrib/eager/python/examples/notebooks/3_training_models.ipynb
deleted file mode 100644
index 84f1d031d4..0000000000
--- a/tensorflow/contrib/eager/python/examples/notebooks/3_training_models.ipynb
+++ /dev/null
@@ -1,485 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "k2o3TTG4TFpt"
- },
- "source": [
- "# Training Models\n",
- "\n",
- "In the previous tutorial we covered the TensorFlow APIs for automatic differentiation, a basic building block for machine learning.\n",
- "In this tutorial we will use the TensorFlow primitives introduced in the prior tutorials to do some simple machine learning.\n",
- "\n",
- "TensorFlow also includes a higher-level neural networks API (`tf.keras`) which provides useful abstractions to reduce boilerplate. We strongly recommend those higher level APIs for people working with neural networks. However, in this short tutorial we cover neural network training from first principles to establish a strong foundation."
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "3LXMVuV0VhDr"
- },
- "source": [
- "## Setup"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "PJ64L90aVir3"
- },
- "outputs": [],
- "source": [
- "import tensorflow as tf\n",
- "tf.enable_eager_execution()\n",
- "tfe = tf.contrib.eager # Shorthand for some symbols"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "eMAWbDJFVmMk"
- },
- "source": [
- "## Variables\n",
- "\n",
- "Tensors in TensorFlow are immutable stateless objects. Machine learning models, however, need to have changing state: as your model trains, the same code to compute predictions should behave differently over time (hopefully with a lower loss!). To represent this state which needs to change over the course of your computation, you can choose to rely on the fact that Python is a stateful programming language:\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "VkJwtLS_Jbn8"
- },
- "outputs": [],
- "source": [
- "# Using python state\n",
- "x = tf.zeros([10, 10])\n",
- "x += 2 # This is equivalent to x = x + 2, which does not mutate the original\n",
- " # value of x\n",
- "print(x)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "wfneTXy7JcUz"
- },
- "source": [
- "TensorFlow, however, has stateful operations built in, and these are often more pleasant to use than low-level Python representations of your state. To represent weights in a model, for example, it's often convenient and efficient to use TensorFlow variables.\n",
- "\n",
- "A Variable is an object which stores a value and, when used in a TensorFlow computation, will implicitly read from this stored value. There are operations (`tf.assign_sub`, `tf.scatter_update`, etc) which manipulate the value stored in a TensorFlow variable."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "itxmrMil6DQi"
- },
- "outputs": [],
- "source": [
- "v = tfe.Variable(1.0)\n",
- "assert v.numpy() == 1.0\n",
- "\n",
- "# Re-assign the value\n",
- "v.assign(3.0)\n",
- "assert v.numpy() == 3.0\n",
- "\n",
- "# Use `v` in a TensorFlow operation like tf.square() and reassign\n",
- "v.assign(tf.square(v))\n",
- "assert v.numpy() == 9.0"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "-paSaeq1JzwC"
- },
- "source": [
- "Computations using Variables are automatically traced when computing gradients. For Variables representing embeddings TensorFlow will do sparse updates by default, which are more computation and memory efficient.\n",
- "\n",
- "Using Variables is also a way to quickly let a reader of your code know that this piece of state is mutable."
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "BMiFcDzE7Qu3"
- },
- "source": [
- "## Example: Fitting a linear model\n",
- "\n",
- "Let's now put the few concepts we have so far ---`Tensor`, `GradientTape`, `Variable` --- to build and train a simple model. This typically involves a few steps:\n",
- "\n",
- "1. Define the model.\n",
- "2. Define a loss function.\n",
- "3. Obtain training data.\n",
- "4. Run through the training data and use an \"optimizer\" to adjust the variables to fit the data.\n",
- "\n",
- "In this tutorial, we'll walk through a trivial example of a simple linear model: `f(x) = x * W + b`, which has two variables - `W` and `b`. Furthermore, we'll synthesize data such that a well trained model would have `W = 3.0` and `b = 2.0`."
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "gFzH64Jn9PIm"
- },
- "source": [
- "### Define the model\n",
- "\n",
- "Let's define a simple class to encapsulate the variables and the computation."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "_WRu7Pze7wk8"
- },
- "outputs": [],
- "source": [
- "class Model(object):\n",
- " def __init__(self):\n",
- " # Initialize variable to (5.0, 0.0)\n",
- " # In practice, these should be initialized to random values.\n",
- " self.W = tfe.Variable(5.0)\n",
- " self.b = tfe.Variable(0.0)\n",
- " \n",
- " def __call__(self, x):\n",
- " return self.W * x + self.b\n",
- " \n",
- "model = Model()\n",
- "\n",
- "assert model(3.0).numpy() == 15.0"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "xa6j_yXa-j79"
- },
- "source": [
- "### Define a loss function\n",
- "\n",
- "A loss function measures how well the output of a model for a given input matches the desired output. Let's use the standard L2 loss."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "Y0ysUFGY924U"
- },
- "outputs": [],
- "source": [
- "def loss(predicted_y, desired_y):\n",
- " return tf.reduce_mean(tf.square(predicted_y - desired_y))"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "qutT_fkl_CBc"
- },
- "source": [
- "### Obtain training data\n",
- "\n",
- "Let's synthesize the training data with some noise."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "gxPTb-kt_N5m"
- },
- "outputs": [],
- "source": [
- "TRUE_W = 3.0\n",
- "TRUE_b = 2.0\n",
- "NUM_EXAMPLES = 1000\n",
- "\n",
- "inputs = tf.random_normal(shape=[NUM_EXAMPLES])\n",
- "noise = tf.random_normal(shape=[NUM_EXAMPLES])\n",
- "outputs = inputs * TRUE_W + TRUE_b + noise"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "-50nq-wPBsAW"
- },
- "source": [
- "Before we train the model let's visualize where the model stands right now. We'll plot the model's predictions in red and the training data in blue."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- },
- "height": 293
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 1210,
- "status": "ok",
- "timestamp": 1527005898290,
- "user": {
- "displayName": "",
- "photoUrl": "",
- "userId": ""
- },
- "user_tz": 420
- },
- "id": "_eb83LtrB4nt",
- "outputId": "3873f508-72fb-41e7-a7f5-3f513deefe38"
- },
- "outputs": [
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEDCAYAAAA2k7/eAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnXlgU1X2xz/pAhRautCWUsCwWVlcUHHGBUFQcSg7uM8P\nFLUICo4VpygObihI3UdmUHBB0IGZQbEgFNGCqKgMolV2pKylCy1pukDp+n5/3LxmaUsDTUjSns8/\nbZKXd09C+b7zvvfccw2apmkIgiAITR4/TwcgCIIgnB9E8AVBEJoJIviCIAjNBBF8QRCEZoIIviAI\nQjNBBF8QBKGZENDYE+Tk5JCUlER+fj7+/v7cdtttTJgwgcLCQhITEzl27BidOnXijTfeICQkxBUx\nC4IgCOeAobF1+Hl5eeTn59OrVy9OnjzJ2LFj+ec//8mnn35KWFgYCQkJLFy4kKKiIh5//HFXxS0I\ngiCcJY22dKKioujVqxcAbdq0oXv37uTm5pKWlsaYMWMAGDNmDF999VVjhxIEQRAagUs9/MzMTPbs\n2cNll13GiRMniIyMBNRFoaCgwJVDCYIgCGeJywT/5MmTPPLII8ycOZM2bdpgMBhcdWpBEATBBbhE\n8CsrK3nkkUcYNWoUN910EwDt2rUjPz8fUD5/REREg+eRtj6CIAjuo9FVOgAzZ86kR48e3HPPPTXP\nDR48mE8//ZRJkyaxcuVKbrzxxgbPYzAYyMsrdkVIbiUqKkTidCESp2vxhTh9IUbwrTidodGCv23b\nNlavXk1cXByjR4/GYDCQmJhI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CH2799Pjx49PB1WDV9/\n/TWRkZH06tWLLVu2OPUejwh+ff159u3bx7Fjxxg1ahSappGbm8u4ceP473//S7t27c5zlA33EdIZ\nPnw4Dz74oMcE/1z6HXkCZ79PbyImJoasrKyax7m5uU73hRLqprKykkceeYRRo0Zx0003eTqcBgkO\nDuYPf/gD3377rVcJ/s8//8yGDRvYtGkTZWVlnDx5kqSkJJKTk+t9j1cZz3FxcWzevJm0tDQ2bNhA\n+/btWblypUfEviEOHz5c83taWhrdunXzYDT1U1+/I2/Gm7LqSy65hCNHjnDs2DHKy8tZs2YNN954\no6fDqhdv+u7qY+bMmfTo0YN77rnH06HUi8lkqrFJTp8+zQ8//OB1/8cfe+wxvv76a9LS0njttdf4\n4x//eEaxBy/08G0xGAxe+wf86quvcvDgQfz8/IiNjeW5557zdEh18sILL1BRUcF9990H2Pc78ia+\n+uorZs+eTUFBAZMnT6Znz568++67ng4Lf39/Zs2axX333Yemadx66610797d02HVyfTp09myZQtm\ns5kbbriBadOmMW7cOE+HZce2bdtYvXo1cXFxjB49GoPBQGJiIgMGDPB0aHbk5eXxxBNPUF1dTXV1\nNfHx8TX7ffgy0ktHEAShmeBVlo4gCILgPkTwBUEQmgki+IIgCM0EEXxBEIRmggi+IAhCM0EEXxAE\noZkggi8IgtBMEMEXBEFoJvw//5K32R/vBHAAAAAASUVORK5CYII=\n",
- "text/plain": [
- "\u003cmatplotlib.figure.Figure at 0x7f5be3c99f50\u003e"
- ]
- },
- "metadata": {
- "tags": []
- },
- "output_type": "display_data"
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Current loss: 9.48636\n"
- ]
- }
- ],
- "source": [
- "import matplotlib.pyplot as plt\n",
- "\n",
- "plt.scatter(inputs, outputs, c='b')\n",
- "plt.scatter(inputs, model(inputs), c='r')\n",
- "plt.show()\n",
- "\n",
- "print('Current loss: '),\n",
- "print(loss(model(inputs), outputs).numpy())"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "sSDP-yeq_4jE"
- },
- "source": [
- "### Define a training loop\n",
- "\n",
- "We now have our network and our training data. Let's train it, i.e., use the training data to update the model's variables (`W` and `b`) so that the loss goes down using [gradient descent](https://en.wikipedia.org/wiki/Gradient_descent). There are many variants of the gradient descent scheme that are captured in `tf.train.Optimizer` implementations. We'd highly recommend using those implementations, but in the spirit of building from first principles, in this particular example we will implement the basic math ourselves."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "MBIACgdnA55X"
- },
- "outputs": [],
- "source": [
- "def train(model, inputs, outputs, learning_rate):\n",
- " with tf.GradientTape() as t:\n",
- " current_loss = loss(model(inputs), outputs)\n",
- " dW, db = t.gradient(current_loss, [model.W, model.b])\n",
- " model.W.assign_sub(learning_rate * dW)\n",
- " model.b.assign_sub(learning_rate * db)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "RwWPaJryD2aN"
- },
- "source": [
- "Finally, let's repeatedly run through the training data and see how `W` and `b` evolve."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- },
- "height": 446
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 569,
- "status": "ok",
- "timestamp": 1527005915434,
- "user": {
- "displayName": "",
- "photoUrl": "",
- "userId": ""
- },
- "user_tz": 420
- },
- "id": "XdfkR223D9dW",
- "outputId": "c43591ae-d5ac-4f2b-a8e7-bfce607e0919"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Epoch 0: W=5.00 b=0.00, loss=9.48636\n",
- "Epoch 1: W=4.58 b=0.42, loss=6.28101\n",
- "Epoch 2: W=4.24 b=0.76, loss=4.29357\n",
- "Epoch 3: W=3.98 b=1.02, loss=3.06128\n",
- "Epoch 4: W=3.78 b=1.23, loss=2.29721\n",
- "Epoch 5: W=3.61 b=1.39, loss=1.82345\n",
- "Epoch 6: W=3.49 b=1.52, loss=1.52970\n",
- "Epoch 7: W=3.38 b=1.62, loss=1.34756\n",
- "Epoch 8: W=3.30 b=1.70, loss=1.23463\n",
- "Epoch 9: W=3.24 b=1.76, loss=1.16460\n"
- ]
- },
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW0AAAEDCAYAAAD+/1UIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl4VOXdPvD7zJZ9XwmELQkQIAELsiTsi6xiEBGXAiIW\nbV8WBY2K0tLa4lbsr283qxURtIoioAi8SpFNg6whi0FJKAoJBgLZt5k5c87vj5OZLIRkgEnOGXJ/\nritXJsmZyT0sN1+enPOMIMuyDCIicgs6tQMQEZHzWNpERG6EpU1E5EZY2kREboSlTUTkRljaRERu\nxODMQePGjYOvry90Oh0MBgM2b97c1rmIiKgZTpW2IAjYuHEjAgIC2joPERG1wKnlEVmWIUlSW2ch\nIqJWCM5cETl+/HgEBARAEATMmTMH9957b3tkIyKiJpxaHvnggw8QFhaG4uJiLFiwAD179sTgwYPb\nOhsRETXh1PJIWFgYACA4OBgTJ05EVlZWi8fL3t6AIADdugFvvglYrTeflIiIWl8eqampgSRJ8PHx\nQXV1NR5++GEsXrwYI0aMuPadCgtRvfoFeL2zDkJtLWxdu6NqRSrMs+8DDE4N9y4XFuaHoqIKVb73\ntTCTc7SYCdBmLmZyjlYzOaPVSfvy5ct44IEHkJKSgjlz5mDcuHEtFzYAREai6oWXUHwkA9WPPApd\n4QX4L/sVgpMGwWPTvwFRdCocERE15tQPIm9Ew3/FdBcK4P3ntfB89x0IVivEmFhUP/kMzCmzAL2+\nLb79VbT6LysztU6LmQBt5mIm52g1kzPa5YpIKaozKl9+DcWHT6Jm7gLof/wB/r98BEGjh8Fj28cA\nTyckInJKu17GLnWJRuXaP6P40AnUPDgP+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\u003cmatplotlib.figure.Figure at 0x7f5be4b8ec50\u003e"
- ]
- },
- "metadata": {
- "tags": []
- },
- "output_type": "display_data"
- }
- ],
- "source": [
- "model = Model()\n",
- "\n",
- "# Collect the history of W-values and b-values to plot later\n",
- "Ws, bs = [], []\n",
- "epochs = range(10)\n",
- "for epoch in epochs:\n",
- " Ws.append(model.W.numpy())\n",
- " bs.append(model.b.numpy())\n",
- " current_loss = loss(model(inputs), outputs)\n",
- "\n",
- " train(model, inputs, outputs, learning_rate=0.1)\n",
- " print('Epoch %2d: W=%1.2f b=%1.2f, loss=%2.5f' %\n",
- " (epoch, Ws[-1], bs[-1], current_loss))\n",
- "\n",
- "# Let's plot it all\n",
- "plt.plot(epochs, Ws, 'r',\n",
- " epochs, bs, 'b')\n",
- "plt.plot([TRUE_W] * len(epochs), 'r--',\n",
- " [TRUE_b] * len(epochs), 'b--')\n",
- "plt.legend(['W', 'b', 'true W', 'true_b'])\n",
- "plt.show()\n",
- " "
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "vPnIVuaSJwWz"
- },
- "source": [
- "## Next Steps\n",
- "\n",
- "In this tutorial we covered `Variable`s and built and trained a simple linear model using the TensorFlow primitives discussed so far.\n",
- "\n",
- "In theory, this is pretty much all you need to use TensorFlow for your machine learning research.\n",
- "In practice, particularly for neural networks, the higher level APIs like `tf.keras` will be much more convenient since it provides higher level building blocks (called \"layers\"), utilities to save and restore state, a suite of loss functions, a suite of optimization strategies etc. \n",
- "\n",
- "The [next tutorial](TODO) will cover these higher level APIs."
- ]
- }
- ],
- "metadata": {
- "colab": {
- "collapsed_sections": [],
- "default_view": {},
- "name": "Training Models",
- "provenance": [],
- "version": "0.3.2",
- "views": {}
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/tensorflow/contrib/eager/python/examples/notebooks/4_high_level.ipynb b/tensorflow/contrib/eager/python/examples/notebooks/4_high_level.ipynb
deleted file mode 100644
index 4fe3a0e3f3..0000000000
--- a/tensorflow/contrib/eager/python/examples/notebooks/4_high_level.ipynb
+++ /dev/null
@@ -1,551 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "pwX7Fii1rwsJ"
- },
- "outputs": [],
- "source": [
- "import tensorflow as tf\n",
- "tf.enable_eager_execution()\n",
- "tfe = tf.contrib.eager\n"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "UEu3q4jmpKVT"
- },
- "source": [
- "# High level API\n",
- "\n",
- "We recommend using `tf.keras` as a high-level API for building neural networks. That said, most TensorFlow APIs are usable with eager execution.\n",
- "\n"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "zSFfVVjkrrsI"
- },
- "source": [
- "## Layers: common sets of useful operations\n",
- "\n",
- "Most of the time when writing code for machine learning models you want to operate at a higher level of abstraction than individual operations and manipulation of individual variables.\n",
- "\n",
- "Many machine learning models are expressible as the composition and stacking of relatively simple layers, and TensorFlow provides both a set of many common layers as a well as easy ways for you to write your own application-specific layers either from scratch or as the composition of existing layers.\n",
- "\n",
- "TensorFlow includes the full [Keras](https://keras.io) API in the tf.keras package, and the Keras layers are very useful when building your own models.\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- }
- },
- "colab_type": "code",
- "id": "8PyXlPl-4TzQ"
- },
- "outputs": [],
- "source": [
- "# In the tf.keras.layers package, layers are objects. To construct a layer,\n",
- "# simply construct the object. Most layers take as a first argument the number\n",
- "# of output dimensions / channels.\n",
- "layer = tf.keras.layers.Dense(100)\n",
- "# The number of input dimensionss is often unnecessary, as it can be inferred\n",
- "# the first time the layer is used, but it can be provided if you want to \n",
- "# specify it manually, which is useful in some complex models.\n",
- "layer = tf.keras.layers.Dense(10, input_shape=(None, 5))"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "Fn69xxPO5Psr"
- },
- "source": [
- "The full list of pre-existing layers can be seen in [the documentation](https://www.tensorflow.org/api_docs/python/tf/keras/layers). It includes Dense (a fully-connected layer),\n",
- "Conv2D, LSTM, BatchNormalization, Dropout, and many others."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- },
- "height": 204
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 244,
- "status": "ok",
- "timestamp": 1527783641557,
- "user": {
- "displayName": "",
- "photoUrl": "",
- "userId": ""
- },
- "user_tz": 420
- },
- "id": "E3XKNknP5Mhb",
- "outputId": "c5d52434-d980-4488-efa7-5660819d0207"
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "\u003ctf.Tensor: id=30, shape=(10, 10), dtype=float32, numpy=\n",
- "array([[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
- " [ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
- " [ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
- " [ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
- " [ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
- " [ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
- " [ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
- " [ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
- " [ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
- " [ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]], dtype=float32)\u003e"
- ]
- },
- "execution_count": 3,
- "metadata": {
- "tags": []
- },
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# To use a layer, simply call it.\n",
- "layer(tf.zeros([10, 5]))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- },
- "height": 221
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 320,
- "status": "ok",
- "timestamp": 1527783642457,
- "user": {
- "displayName": "",
- "photoUrl": "",
- "userId": ""
- },
- "user_tz": 420
- },
- "id": "Wt_Nsv-L5t2s",
- "outputId": "f0d96dce-0128-4080-bfe2-0ee6fbc0ad90"
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "[\u003ctf.Variable 'dense_1/kernel:0' shape=(5, 10) dtype=float32, numpy=\n",
- " array([[ 0.43788117, -0.62099844, -0.30525017, -0.59352523, 0.1783089 ,\n",
- " 0.47078604, -0.23620895, -0.30482283, 0.01366901, -0.1288507 ],\n",
- " [ 0.18407935, -0.56550485, 0.54180616, -0.42254075, 0.3702994 ,\n",
- " 0.36705834, -0.29678228, 0.36660975, 0.36717761, 0.46269661],\n",
- " [ 0.1709305 , -0.11529458, 0.32710236, 0.46300393, -0.62802851,\n",
- " 0.51641601, 0.39624029, 0.26918125, -0.25196898, 0.21353298],\n",
- " [ 0.35752094, 0.44161648, 0.61500639, -0.12653333, 0.41629118,\n",
- " 0.36193585, 0.066082 , -0.59253877, 0.47318751, 0.17115968],\n",
- " [-0.22554061, -0.17727301, 0.5525015 , 0.3678053 , -0.00454676,\n",
- " 0.24066836, -0.53640735, 0.13792562, -0.10727292, 0.59708995]], dtype=float32)\u003e,\n",
- " \u003ctf.Variable 'dense_1/bias:0' shape=(10,) dtype=float32, numpy=array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], dtype=float32)\u003e]"
- ]
- },
- "execution_count": 4,
- "metadata": {
- "tags": []
- },
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# Layers have many useful methods. For example, you can inspect all variables\n",
- "# in a layer by calling layer.variables. In this case a fully-connected layer\n",
- "# will have variables for weights and biases.\n",
- "layer.variables"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- },
- "height": 221
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 226,
- "status": "ok",
- "timestamp": 1527783643252,
- "user": {
- "displayName": "",
- "photoUrl": "",
- "userId": ""
- },
- "user_tz": 420
- },
- "id": "6ilvKjz8_4MQ",
- "outputId": "f647fced-c2d7-41a3-c237-242036784665"
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "(\u003ctf.Variable 'dense_1/kernel:0' shape=(5, 10) dtype=float32, numpy=\n",
- " array([[ 0.43788117, -0.62099844, -0.30525017, -0.59352523, 0.1783089 ,\n",
- " 0.47078604, -0.23620895, -0.30482283, 0.01366901, -0.1288507 ],\n",
- " [ 0.18407935, -0.56550485, 0.54180616, -0.42254075, 0.3702994 ,\n",
- " 0.36705834, -0.29678228, 0.36660975, 0.36717761, 0.46269661],\n",
- " [ 0.1709305 , -0.11529458, 0.32710236, 0.46300393, -0.62802851,\n",
- " 0.51641601, 0.39624029, 0.26918125, -0.25196898, 0.21353298],\n",
- " [ 0.35752094, 0.44161648, 0.61500639, -0.12653333, 0.41629118,\n",
- " 0.36193585, 0.066082 , -0.59253877, 0.47318751, 0.17115968],\n",
- " [-0.22554061, -0.17727301, 0.5525015 , 0.3678053 , -0.00454676,\n",
- " 0.24066836, -0.53640735, 0.13792562, -0.10727292, 0.59708995]], dtype=float32)\u003e,\n",
- " \u003ctf.Variable 'dense_1/bias:0' shape=(10,) dtype=float32, numpy=array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], dtype=float32)\u003e)"
- ]
- },
- "execution_count": 5,
- "metadata": {
- "tags": []
- },
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# The variables are also accessible through nice accessors\n",
- "layer.kernel, layer.bias"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "O0kDbE54-5VS"
- },
- "source": [
- "## Implementing custom layers\n",
- "The best way to implement your own layer is extending the tf.keras.Layer class and implementing:\n",
- " * `__init__` , where you can do all input-independent initialization\n",
- " * `build`, where you know the shapes of the input tensors and can do the rest of the initialization\n",
- " * `call`, where you do the forward computation\n",
- "\n",
- "Note that you don't have to wait until `build` is called to create your variables, you can also create them in `__init__`. However, the advantage of creating them in `build` is that it enables late variable creation based on the shape of the inputs the layer will operate on. On the other hand, creating variables in `__init__` would mean that shapes requires to create the variables will need to be explicitly specified."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 7,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- },
- "height": 391
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 251,
- "status": "ok",
- "timestamp": 1527783661512,
- "user": {
- "displayName": "",
- "photoUrl": "",
- "userId": ""
- },
- "user_tz": 420
- },
- "id": "5Byl3n1k5kIy",
- "outputId": "6e7f9285-649a-4132-82ce-73ea92f15862"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "tf.Tensor(\n",
- "[[ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
- " [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
- " [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
- " [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
- " [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
- " [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
- " [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
- " [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
- " [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]\n",
- " [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]], shape=(10, 10), dtype=float32)\n",
- "[\u003ctf.Variable 'my_dense_layer_1/kernel:0' shape=(5, 10) dtype=float32, numpy=\n",
- "array([[-0.4011991 , 0.22458655, -0.33237562, -0.25117266, 0.33528614,\n",
- " -0.01392961, 0.58580834, -0.16346583, 0.28465688, -0.47191954],\n",
- " [-0.52922136, 0.22416979, -0.58209574, -0.60914612, 0.05226624,\n",
- " -0.18325993, 0.5591442 , -0.24718609, 0.37148207, 0.40475875],\n",
- " [ 0.16912812, -0.47618777, -0.38989353, 0.30105609, -0.08085585,\n",
- " 0.44758242, 0.545829 , 0.51421839, 0.11063248, 0.20159996],\n",
- " [ 0.34073615, -0.59835428, 0.06498981, -0.44489855, -0.34302285,\n",
- " 0.20969599, 0.35527444, -0.03173476, -0.22227573, 0.09303057],\n",
- " [ 0.41764337, -0.06435019, -0.52509922, -0.39957345, 0.56811184,\n",
- " 0.23481232, -0.61666459, 0.31144124, -0.11532354, -0.42421889]], dtype=float32)\u003e]\n"
- ]
- }
- ],
- "source": [
- "class MyDenseLayer(tf.keras.layers.Layer):\n",
- " def __init__(self, num_outputs):\n",
- " super(MyDenseLayer, self).__init__()\n",
- " self.num_outputs = num_outputs\n",
- " \n",
- " def build(self, input_shape):\n",
- " self.kernel = self.add_variable(\"kernel\", \n",
- " shape=[input_shape[-1].value, \n",
- " self.num_outputs])\n",
- " \n",
- " def call(self, input):\n",
- " return tf.matmul(input, self.kernel)\n",
- " \n",
- "layer = MyDenseLayer(10)\n",
- "print(layer(tf.zeros([10, 5])))\n",
- "print(layer.variables)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "tk8E2vY0-z4Z"
- },
- "source": [
- "Note that you don't have to wait until `build` is called to create your variables, you can also create them in `__init__`.\n",
- "\n",
- "Overall code is easier to read and maintain if it uses standard layers whenever possible, as other readers will be familiar with the behavior of standard layers. If you want to use a layer which is not present in tf.keras.layers or tf.contrib.layers, consider filing a [github issue](http://github.com/tensorflow/tensorflow/issues/new) or, even better, sending us a pull request!"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "Qhg4KlbKrs3G"
- },
- "source": [
- "## Models: composing layers\n",
- "\n",
- "Many interesting layer-like things in machine learning models are implemented by composing existing layers. For example, each residual block in a resnet is a composition of convolutions, batch normalizations, and a shortcut.\n",
- "\n",
- "The main class used when creating a layer-like thing which contains other layers is tf.keras.Model. Implementing one is done by inheriting from tf.keras.Model."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 9,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- },
- "height": 190
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 420,
- "status": "ok",
- "timestamp": 1527783698512,
- "user": {
- "displayName": "",
- "photoUrl": "",
- "userId": ""
- },
- "user_tz": 420
- },
- "id": "N30DTXiRASlb",
- "outputId": "a8b23a8e-5cf9-4bbf-f93b-6c763d74e2b3"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "tf.Tensor(\n",
- "[[[[ 0. 0. 0.]\n",
- " [ 0. 0. 0.]\n",
- " [ 0. 0. 0.]]\n",
- "\n",
- " [[ 0. 0. 0.]\n",
- " [ 0. 0. 0.]\n",
- " [ 0. 0. 0.]]]], shape=(1, 2, 3, 3), dtype=float32)\n",
- "['resnet_identity_block_1/conv2d_3/kernel:0', 'resnet_identity_block_1/conv2d_3/bias:0', 'resnet_identity_block_1/batch_normalization_3/gamma:0', 'resnet_identity_block_1/batch_normalization_3/beta:0', 'resnet_identity_block_1/conv2d_4/kernel:0', 'resnet_identity_block_1/conv2d_4/bias:0', 'resnet_identity_block_1/batch_normalization_4/gamma:0', 'resnet_identity_block_1/batch_normalization_4/beta:0', 'resnet_identity_block_1/conv2d_5/kernel:0', 'resnet_identity_block_1/conv2d_5/bias:0', 'resnet_identity_block_1/batch_normalization_5/gamma:0', 'resnet_identity_block_1/batch_normalization_5/beta:0', 'resnet_identity_block_1/batch_normalization_3/moving_mean:0', 'resnet_identity_block_1/batch_normalization_3/moving_variance:0', 'resnet_identity_block_1/batch_normalization_4/moving_mean:0', 'resnet_identity_block_1/batch_normalization_4/moving_variance:0', 'resnet_identity_block_1/batch_normalization_5/moving_mean:0', 'resnet_identity_block_1/batch_normalization_5/moving_variance:0']\n"
- ]
- }
- ],
- "source": [
- "class ResnetIdentityBlock(tf.keras.Model):\n",
- " def __init__(self, kernel_size, filters):\n",
- " super(ResnetIdentityBlock, self).__init__(name='')\n",
- " filters1, filters2, filters3 = filters\n",
- "\n",
- " self.conv2a = tf.keras.layers.Conv2D(filters1, (1, 1))\n",
- " self.bn2a = tf.keras.layers.BatchNormalization()\n",
- "\n",
- " self.conv2b = tf.keras.layers.Conv2D(filters2, kernel_size, padding='same')\n",
- " self.bn2b = tf.keras.layers.BatchNormalization()\n",
- "\n",
- " self.conv2c = tf.keras.layers.Conv2D(filters3, (1, 1))\n",
- " self.bn2c = tf.keras.layers.BatchNormalization()\n",
- "\n",
- " def call(self, input_tensor, training=False):\n",
- " x = self.conv2a(input_tensor)\n",
- " x = self.bn2a(x, training=training)\n",
- " x = tf.nn.relu(x)\n",
- "\n",
- " x = self.conv2b(x)\n",
- " x = self.bn2b(x, training=training)\n",
- " x = tf.nn.relu(x)\n",
- "\n",
- " x = self.conv2c(x)\n",
- " x = self.bn2c(x, training=training)\n",
- "\n",
- " x += input_tensor\n",
- " return tf.nn.relu(x)\n",
- "\n",
- " \n",
- "block = ResnetIdentityBlock(1, [1, 2, 3])\n",
- "print(block(tf.zeros([1, 2, 3, 3])))\n",
- "print([x.name for x in block.variables])"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "wYfucVw65PMj"
- },
- "source": [
- "Much of the time, however, models which compose many layers simply call one layer after the other. This can be done in very little code using tf.keras.Sequential"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {
- "autoexec": {
- "startup": false,
- "wait_interval": 0
- },
- "base_uri": "https://localhost:8080/",
- "height": 153
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 361,
- "status": "ok",
- "timestamp": 1526674830777,
- "user": {
- "displayName": "Alexandre Passos",
- "photoUrl": "//lh4.googleusercontent.com/-kmTTWXEgAPw/AAAAAAAAAAI/AAAAAAAAAC0/q_DoOzKGwds/s50-c-k-no/photo.jpg",
- "userId": "108023195365833072773"
- },
- "user_tz": 420
- },
- "id": "L9frk7Ur4uvJ",
- "outputId": "882e9076-b6d9-4380-bb1e-7c6b57d54c39"
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "\u003ctf.Tensor: id=1423, shape=(1, 2, 3, 3), dtype=float32, numpy=\n",
- "array([[[[0., 0., 0.],\n",
- " [0., 0., 0.],\n",
- " [0., 0., 0.]],\n",
- "\n",
- " [[0., 0., 0.],\n",
- " [0., 0., 0.],\n",
- " [0., 0., 0.]]]], dtype=float32)\u003e"
- ]
- },
- "execution_count": 26,
- "metadata": {
- "tags": []
- },
- "output_type": "execute_result"
- }
- ],
- "source": [
- " my_seq = tf.keras.Sequential([tf.keras.layers.Conv2D(1, (1, 1)),\n",
- " tf.keras.layers.BatchNormalization(),\n",
- " tf.keras.layers.Conv2D(2, 1, \n",
- " padding='same'),\n",
- " tf.keras.layers.BatchNormalization(),\n",
- " tf.keras.layers.Conv2D(3, (1, 1)),\n",
- " tf.keras.layers.BatchNormalization()])\n",
- "my_seq(tf.zeros([1, 2, 3, 3]))"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "c5YwYcnuK-wc"
- },
- "source": [
- "# Next steps\n",
- "\n",
- "Now you can go back to the previous notebook and adapt the linear regression example to use layers and models to be better structured."
- ]
- }
- ],
- "metadata": {
- "colab": {
- "collapsed_sections": [],
- "default_view": {},
- "name": "4 - High level API - TensorFlow Eager.ipynb",
- "provenance": [],
- "version": "0.3.2",
- "views": {}
- },
- "kernelspec": {
- "display_name": "Python 3",
- "name": "python3"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/tensorflow/contrib/eager/python/examples/notebooks/README.md b/tensorflow/contrib/eager/python/examples/notebooks/README.md
new file mode 100644
index 0000000000..0d5ed84894
--- /dev/null
+++ b/tensorflow/contrib/eager/python/examples/notebooks/README.md
@@ -0,0 +1,11 @@
+## Research and experimentation
+
+Eager execution provides an imperative, define-by-run interface for advanced
+operations. Write custom layers, forward passes, and training loops with auto
+differentiation. Start with these notebooks, then read the
+[eager execution guide](https://www.tensorflow.org/guide/eager).
+
+1. [Eager execution basics](./eager_basics.ipynb)
+2. [Automatic differentiation and gradient tapes](./automatic_differentiation.ipynb)
+3. [Custom training: basics](./custom_training.ipynb)
+4. [Custom layers](./custom_layers.ipynb)
diff --git a/tensorflow/contrib/eager/python/examples/notebooks/automatic_differentiation.ipynb b/tensorflow/contrib/eager/python/examples/notebooks/automatic_differentiation.ipynb
new file mode 100644
index 0000000000..a18882fafa
--- /dev/null
+++ b/tensorflow/contrib/eager/python/examples/notebooks/automatic_differentiation.ipynb
@@ -0,0 +1,364 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "name": "automatic_differentiation.ipynb",
+ "version": "0.3.2",
+ "views": {},
+ "default_view": {},
+ "provenance": [],
+ "private_outputs": true,
+ "collapsed_sections": [],
+ "toc_visible": true
+ },
+ "kernelspec": {
+ "name": "python3",
+ "display_name": "Python 3"
+ }
+ },
+ "cells": [
+ {
+ "metadata": {
+ "id": "t09eeeR5prIJ",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "##### Copyright 2018 The TensorFlow Authors."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "GCCk8_dHpuNf",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ },
+ "cellView": "form"
+ },
+ "cell_type": "code",
+ "source": [
+ "#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n",
+ "# you may not use this file except in compliance with the License.\n",
+ "# You may obtain a copy of the License at\n",
+ "#\n",
+ "# https://www.apache.org/licenses/LICENSE-2.0\n",
+ "#\n",
+ "# Unless required by applicable law or agreed to in writing, software\n",
+ "# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
+ "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
+ "# See the License for the specific language governing permissions and\n",
+ "# limitations under the License."
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "xh8WkEwWpnm7",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "# Automatic differentiation and gradient tape"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "idv0bPeCp325",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ ""
+ ]
+ },
+ {
+ "metadata": {
+ "id": "vDJ4XzMqodTy",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "In the previous tutorial we introduced `Tensor`s and operations on them. In this tutorial we will cover [automatic differentiation](https://en.wikipedia.org/wiki/Automatic_differentiation), a key technique for optimizing machine learning models."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "GQJysDM__Qb0",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Setup\n"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "OiMPZStlibBv",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "import tensorflow as tf\n",
+ "tf.enable_eager_execution()\n",
+ "\n",
+ "tfe = tf.contrib.eager # Shorthand for some symbols"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "1CLWJl0QliB0",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Derivatives of a function\n",
+ "\n",
+ "TensorFlow provides APIs for automatic differentiation - computing the derivative of a function. The way that more closely mimics the math is to encapsulate the computation in a Python function, say `f`, and use `tfe.gradients_function` to create a function that computes the derivatives of `f` with respect to its arguments. If you're familiar with [autograd](https://github.com/HIPS/autograd) for differentiating numpy functions, this will be familiar. For example: "
+ ]
+ },
+ {
+ "metadata": {
+ "id": "9FViq92UX7P8",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "from math import pi\n",
+ "\n",
+ "def f(x):\n",
+ " return tf.square(tf.sin(x))\n",
+ "\n",
+ "assert f(pi/2).numpy() == 1.0\n",
+ "\n",
+ "\n",
+ "# grad_f will return a list of derivatives of f\n",
+ "# with respect to its arguments. Since f() has a single argument,\n",
+ "# grad_f will return a list with a single element.\n",
+ "grad_f = tfe.gradients_function(f)\n",
+ "assert tf.abs(grad_f(pi/2)[0]).numpy() < 1e-7"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "v9fPs8RyopCf",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "### Higher-order gradients\n",
+ "\n",
+ "The same API can be used to differentiate as many times as you like:\n"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "3D0ZvnGYo0rW",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "def f(x):\n",
+ " return tf.square(tf.sin(x))\n",
+ "\n",
+ "def grad(f):\n",
+ " return lambda x: tfe.gradients_function(f)(x)[0]\n",
+ "\n",
+ "x = tf.lin_space(-2*pi, 2*pi, 100) # 100 points between -2π and +2π\n",
+ "\n",
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "plt.plot(x, f(x), label=\"f\")\n",
+ "plt.plot(x, grad(f)(x), label=\"first derivative\")\n",
+ "plt.plot(x, grad(grad(f))(x), label=\"second derivative\")\n",
+ "plt.plot(x, grad(grad(grad(f)))(x), label=\"third derivative\")\n",
+ "plt.legend()\n",
+ "plt.show()"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "-39gouo7mtgu",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Gradient tapes\n",
+ "\n",
+ "Every differentiable TensorFlow operation has an associated gradient function. For example, the gradient function of `tf.square(x)` would be a function that returns `2.0 * x`. To compute the gradient of a user-defined function (like `f(x)` in the example above), TensorFlow first \"records\" all the operations applied to compute the output of the function. We call this record a \"tape\". It then uses that tape and the gradients functions associated with each primitive operation to compute the gradients of the user-defined function using [reverse mode differentiation](https://en.wikipedia.org/wiki/Automatic_differentiation).\n",
+ "\n",
+ "Since operations are recorded as they are executed, Python control flow (using `if`s and `while`s for example) is naturally handled:\n",
+ "\n"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "MH0UfjympWf7",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "def f(x, y):\n",
+ " output = 1\n",
+ " for i in range(y):\n",
+ " output = tf.multiply(output, x)\n",
+ " return output\n",
+ "\n",
+ "def g(x, y):\n",
+ " # Return the gradient of `f` with respect to it's first parameter\n",
+ " return tfe.gradients_function(f)(x, y)[0]\n",
+ "\n",
+ "assert f(3.0, 2).numpy() == 9.0 # f(x, 2) is essentially x * x\n",
+ "assert g(3.0, 2).numpy() == 6.0 # And its gradient will be 2 * x\n",
+ "assert f(4.0, 3).numpy() == 64.0 # f(x, 3) is essentially x * x * x\n",
+ "assert g(4.0, 3).numpy() == 48.0 # And its gradient will be 3 * x * x"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "aNmR5-jhpX2t",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "At times it may be inconvenient to encapsulate computation of interest into a function. For example, if you want the gradient of the output with respect to intermediate values computed in the function. In such cases, the slightly more verbose but explicit [tf.GradientTape](https://www.tensorflow.org/api_docs/python/tf/GradientTape) context is useful. All computation inside the context of a `tf.GradientTape` is \"recorded\".\n",
+ "\n",
+ "For example:"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "bAFeIE8EuVIq",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "x = tf.ones((2, 2))\n",
+ " \n",
+ "# TODO(b/78880779): Remove the 'persistent=True' argument and use\n",
+ "# a single t.gradient() call when the bug is resolved.\n",
+ "with tf.GradientTape(persistent=True) as t:\n",
+ " # TODO(ashankar): Explain with \"watch\" argument better?\n",
+ " t.watch(x)\n",
+ " y = tf.reduce_sum(x)\n",
+ " z = tf.multiply(y, y)\n",
+ "\n",
+ "# Use the same tape to compute the derivative of z with respect to the\n",
+ "# intermediate value y.\n",
+ "dz_dy = t.gradient(z, y)\n",
+ "assert dz_dy.numpy() == 8.0\n",
+ "\n",
+ "# Derivative of z with respect to the original input tensor x\n",
+ "dz_dx = t.gradient(z, x)\n",
+ "for i in [0, 1]:\n",
+ " for j in [0, 1]:\n",
+ " assert dz_dx[i][j].numpy() == 8.0"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "DK05KXrAAld3",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "### Higher-order gradients\n",
+ "\n",
+ "Operations inside of the `GradientTape` context manager are recorded for automatic differentiation. If gradients are computed in that context, then the gradient computation is recorded as well. As a result, the exact same API works for higher-order gradients as well. For example:"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "cPQgthZ7ugRJ",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "# TODO(ashankar): Should we use the persistent tape here instead? Follow up on Tom and Alex's discussion\n",
+ "\n",
+ "x = tf.constant(1.0) # Convert the Python 1.0 to a Tensor object\n",
+ "\n",
+ "with tf.GradientTape() as t:\n",
+ " with tf.GradientTape() as t2:\n",
+ " t2.watch(x)\n",
+ " y = x * x * x\n",
+ " # Compute the gradient inside the 't' context manager\n",
+ " # which means the gradient computation is differentiable as well.\n",
+ " dy_dx = t2.gradient(y, x)\n",
+ "d2y_dx2 = t.gradient(dy_dx, x)\n",
+ "\n",
+ "assert dy_dx.numpy() == 3.0\n",
+ "assert d2y_dx2.numpy() == 6.0"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "4U1KKzUpNl58",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Next Steps\n",
+ "\n",
+ "In this tutorial we covered gradient computation in TensorFlow. With that we have enough of the primitives required to build an train neural networks, which we will cover in the [next tutorial](https://github.com/tensorflow/models/tree/master/official/contrib/eager/python/examples/notebooks/3_neural_networks.ipynb)."
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/tensorflow/contrib/eager/python/examples/notebooks/custom_layers.ipynb b/tensorflow/contrib/eager/python/examples/notebooks/custom_layers.ipynb
new file mode 100644
index 0000000000..54fbf2a7e1
--- /dev/null
+++ b/tensorflow/contrib/eager/python/examples/notebooks/custom_layers.ipynb
@@ -0,0 +1,399 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "name": "custom_layers.ipynb",
+ "version": "0.3.2",
+ "views": {},
+ "default_view": {},
+ "provenance": [],
+ "private_outputs": true,
+ "collapsed_sections": [],
+ "toc_visible": true
+ },
+ "kernelspec": {
+ "display_name": "Python 3",
+ "name": "python3"
+ }
+ },
+ "cells": [
+ {
+ "metadata": {
+ "id": "tDnwEv8FtJm7",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "##### Copyright 2018 The TensorFlow Authors."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "JlknJBWQtKkI",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ },
+ "cellView": "form"
+ },
+ "cell_type": "code",
+ "source": [
+ "#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n",
+ "# you may not use this file except in compliance with the License.\n",
+ "# You may obtain a copy of the License at\n",
+ "#\n",
+ "# https://www.apache.org/licenses/LICENSE-2.0\n",
+ "#\n",
+ "# Unless required by applicable law or agreed to in writing, software\n",
+ "# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
+ "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
+ "# See the License for the specific language governing permissions and\n",
+ "# limitations under the License."
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "60RdWsg1tETW",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "# Custom layers"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "BcJg7Enms86w",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ ""
+ ]
+ },
+ {
+ "metadata": {
+ "id": "UEu3q4jmpKVT",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "We recommend using `tf.keras` as a high-level API for building neural networks. That said, most TensorFlow APIs are usable with eager execution.\n"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "pwX7Fii1rwsJ",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "import tensorflow as tf\n",
+ "tfe = tf.contrib.eager\n",
+ "\n",
+ "tf.enable_eager_execution()"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "zSFfVVjkrrsI",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Layers: common sets of useful operations\n",
+ "\n",
+ "Most of the time when writing code for machine learning models you want to operate at a higher level of abstraction than individual operations and manipulation of individual variables.\n",
+ "\n",
+ "Many machine learning models are expressible as the composition and stacking of relatively simple layers, and TensorFlow provides both a set of many common layers as a well as easy ways for you to write your own application-specific layers either from scratch or as the composition of existing layers.\n",
+ "\n",
+ "TensorFlow includes the full [Keras](https://keras.io) API in the tf.keras package, and the Keras layers are very useful when building your own models.\n"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "8PyXlPl-4TzQ",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "# In the tf.keras.layers package, layers are objects. To construct a layer,\n",
+ "# simply construct the object. Most layers take as a first argument the number\n",
+ "# of output dimensions / channels.\n",
+ "layer = tf.keras.layers.Dense(100)\n",
+ "# The number of input dimensions is often unnecessary, as it can be inferred\n",
+ "# the first time the layer is used, but it can be provided if you want to \n",
+ "# specify it manually, which is useful in some complex models.\n",
+ "layer = tf.keras.layers.Dense(10, input_shape=(None, 5))"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "Fn69xxPO5Psr",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "The full list of pre-existing layers can be seen in [the documentation](https://www.tensorflow.org/api_docs/python/tf/keras/layers). It includes Dense (a fully-connected layer),\n",
+ "Conv2D, LSTM, BatchNormalization, Dropout, and many others."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "E3XKNknP5Mhb",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "# To use a layer, simply call it.\n",
+ "layer(tf.zeros([10, 5]))"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "Wt_Nsv-L5t2s",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "# Layers have many useful methods. For example, you can inspect all variables\n",
+ "# in a layer by calling layer.variables. In this case a fully-connected layer\n",
+ "# will have variables for weights and biases.\n",
+ "layer.variables"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "6ilvKjz8_4MQ",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "# The variables are also accessible through nice accessors\n",
+ "layer.kernel, layer.bias"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "O0kDbE54-5VS",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Implementing custom layers\n",
+ "The best way to implement your own layer is extending the tf.keras.Layer class and implementing:\n",
+ " * `__init__` , where you can do all input-independent initialization\n",
+ " * `build`, where you know the shapes of the input tensors and can do the rest of the initialization\n",
+ " * `call`, where you do the forward computation\n",
+ "\n",
+ "Note that you don't have to wait until `build` is called to create your variables, you can also create them in `__init__`. However, the advantage of creating them in `build` is that it enables late variable creation based on the shape of the inputs the layer will operate on. On the other hand, creating variables in `__init__` would mean that shapes required to create the variables will need to be explicitly specified."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "5Byl3n1k5kIy",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "class MyDenseLayer(tf.keras.layers.Layer):\n",
+ " def __init__(self, num_outputs):\n",
+ " super(MyDenseLayer, self).__init__()\n",
+ " self.num_outputs = num_outputs\n",
+ " \n",
+ " def build(self, input_shape):\n",
+ " self.kernel = self.add_variable(\"kernel\", \n",
+ " shape=[input_shape[-1].value, \n",
+ " self.num_outputs])\n",
+ " \n",
+ " def call(self, input):\n",
+ " return tf.matmul(input, self.kernel)\n",
+ " \n",
+ "layer = MyDenseLayer(10)\n",
+ "print(layer(tf.zeros([10, 5])))\n",
+ "print(layer.variables)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "tk8E2vY0-z4Z",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "Note that you don't have to wait until `build` is called to create your variables, you can also create them in `__init__`.\n",
+ "\n",
+ "Overall code is easier to read and maintain if it uses standard layers whenever possible, as other readers will be familiar with the behavior of standard layers. If you want to use a layer which is not present in tf.keras.layers or tf.contrib.layers, consider filing a [github issue](http://github.com/tensorflow/tensorflow/issues/new) or, even better, sending us a pull request!"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "Qhg4KlbKrs3G",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Models: composing layers\n",
+ "\n",
+ "Many interesting layer-like things in machine learning models are implemented by composing existing layers. For example, each residual block in a resnet is a composition of convolutions, batch normalizations, and a shortcut.\n",
+ "\n",
+ "The main class used when creating a layer-like thing which contains other layers is tf.keras.Model. Implementing one is done by inheriting from tf.keras.Model."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "N30DTXiRASlb",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "class ResnetIdentityBlock(tf.keras.Model):\n",
+ " def __init__(self, kernel_size, filters):\n",
+ " super(ResnetIdentityBlock, self).__init__(name='')\n",
+ " filters1, filters2, filters3 = filters\n",
+ "\n",
+ " self.conv2a = tf.keras.layers.Conv2D(filters1, (1, 1))\n",
+ " self.bn2a = tf.keras.layers.BatchNormalization()\n",
+ "\n",
+ " self.conv2b = tf.keras.layers.Conv2D(filters2, kernel_size, padding='same')\n",
+ " self.bn2b = tf.keras.layers.BatchNormalization()\n",
+ "\n",
+ " self.conv2c = tf.keras.layers.Conv2D(filters3, (1, 1))\n",
+ " self.bn2c = tf.keras.layers.BatchNormalization()\n",
+ "\n",
+ " def call(self, input_tensor, training=False):\n",
+ " x = self.conv2a(input_tensor)\n",
+ " x = self.bn2a(x, training=training)\n",
+ " x = tf.nn.relu(x)\n",
+ "\n",
+ " x = self.conv2b(x)\n",
+ " x = self.bn2b(x, training=training)\n",
+ " x = tf.nn.relu(x)\n",
+ "\n",
+ " x = self.conv2c(x)\n",
+ " x = self.bn2c(x, training=training)\n",
+ "\n",
+ " x += input_tensor\n",
+ " return tf.nn.relu(x)\n",
+ "\n",
+ " \n",
+ "block = ResnetIdentityBlock(1, [1, 2, 3])\n",
+ "print(block(tf.zeros([1, 2, 3, 3])))\n",
+ "print([x.name for x in block.variables])"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "wYfucVw65PMj",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "Much of the time, however, models which compose many layers simply call one layer after the other. This can be done in very little code using tf.keras.Sequential"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "L9frk7Ur4uvJ",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ " my_seq = tf.keras.Sequential([tf.keras.layers.Conv2D(1, (1, 1)),\n",
+ " tf.keras.layers.BatchNormalization(),\n",
+ " tf.keras.layers.Conv2D(2, 1, \n",
+ " padding='same'),\n",
+ " tf.keras.layers.BatchNormalization(),\n",
+ " tf.keras.layers.Conv2D(3, (1, 1)),\n",
+ " tf.keras.layers.BatchNormalization()])\n",
+ "my_seq(tf.zeros([1, 2, 3, 3]))"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "c5YwYcnuK-wc",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "# Next steps\n",
+ "\n",
+ "Now you can go back to the previous notebook and adapt the linear regression example to use layers and models to be better structured."
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/tensorflow/contrib/eager/python/examples/notebooks/custom_training.ipynb b/tensorflow/contrib/eager/python/examples/notebooks/custom_training.ipynb
new file mode 100644
index 0000000000..0a781d2153
--- /dev/null
+++ b/tensorflow/contrib/eager/python/examples/notebooks/custom_training.ipynb
@@ -0,0 +1,478 @@
+{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "name": "Custom training: basics",
+ "version": "0.3.2",
+ "views": {},
+ "default_view": {},
+ "provenance": [],
+ "private_outputs": true,
+ "collapsed_sections": [],
+ "toc_visible": true
+ },
+ "kernelspec": {
+ "name": "python3",
+ "display_name": "Python 3"
+ }
+ },
+ "cells": [
+ {
+ "metadata": {
+ "id": "5rmpybwysXGV",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "##### Copyright 2018 The TensorFlow Authors."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "m8y3rGtQsYP2",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ },
+ "cellView": "form"
+ },
+ "cell_type": "code",
+ "source": [
+ "#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n",
+ "# you may not use this file except in compliance with the License.\n",
+ "# You may obtain a copy of the License at\n",
+ "#\n",
+ "# https://www.apache.org/licenses/LICENSE-2.0\n",
+ "#\n",
+ "# Unless required by applicable law or agreed to in writing, software\n",
+ "# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
+ "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
+ "# See the License for the specific language governing permissions and\n",
+ "# limitations under the License."
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "hrXv0rU9sIma",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "# Custom training: basics"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "7S0BwJ_8sLu7",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ ""
+ ]
+ },
+ {
+ "metadata": {
+ "id": "k2o3TTG4TFpt",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "In the previous tutorial we covered the TensorFlow APIs for automatic differentiation, a basic building block for machine learning.\n",
+ "In this tutorial we will use the TensorFlow primitives introduced in the prior tutorials to do some simple machine learning.\n",
+ "\n",
+ "TensorFlow also includes a higher-level neural networks API (`tf.keras`) which provides useful abstractions to reduce boilerplate. We strongly recommend those higher level APIs for people working with neural networks. However, in this short tutorial we cover neural network training from first principles to establish a strong foundation."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "3LXMVuV0VhDr",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Setup"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "PJ64L90aVir3",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "import tensorflow as tf\n",
+ "tfe = tf.contrib.eager # Shorthand for some symbols\n",
+ "\n",
+ "tf.enable_eager_execution()"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "eMAWbDJFVmMk",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Variables\n",
+ "\n",
+ "Tensors in TensorFlow are immutable stateless objects. Machine learning models, however, need to have changing state: as your model trains, the same code to compute predictions should behave differently over time (hopefully with a lower loss!). To represent this state which needs to change over the course of your computation, you can choose to rely on the fact that Python is a stateful programming language:\n"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "VkJwtLS_Jbn8",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "# Using python state\n",
+ "x = tf.zeros([10, 10])\n",
+ "x += 2 # This is equivalent to x = x + 2, which does not mutate the original\n",
+ " # value of x\n",
+ "print(x)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "wfneTXy7JcUz",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "TensorFlow, however, has stateful operations built in, and these are often more pleasant to use than low-level Python representations of your state. To represent weights in a model, for example, it's often convenient and efficient to use TensorFlow variables.\n",
+ "\n",
+ "A Variable is an object which stores a value and, when used in a TensorFlow computation, will implicitly read from this stored value. There are operations (`tf.assign_sub`, `tf.scatter_update`, etc) which manipulate the value stored in a TensorFlow variable."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "itxmrMil6DQi",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "v = tfe.Variable(1.0)\n",
+ "assert v.numpy() == 1.0\n",
+ "\n",
+ "# Re-assign the value\n",
+ "v.assign(3.0)\n",
+ "assert v.numpy() == 3.0\n",
+ "\n",
+ "# Use `v` in a TensorFlow operation like tf.square() and reassign\n",
+ "v.assign(tf.square(v))\n",
+ "assert v.numpy() == 9.0"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "-paSaeq1JzwC",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "Computations using Variables are automatically traced when computing gradients. For Variables representing embeddings TensorFlow will do sparse updates by default, which are more computation and memory efficient.\n",
+ "\n",
+ "Using Variables is also a way to quickly let a reader of your code know that this piece of state is mutable."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "BMiFcDzE7Qu3",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Example: Fitting a linear model\n",
+ "\n",
+ "Let's now put the few concepts we have so far ---`Tensor`, `GradientTape`, `Variable` --- to build and train a simple model. This typically involves a few steps:\n",
+ "\n",
+ "1. Define the model.\n",
+ "2. Define a loss function.\n",
+ "3. Obtain training data.\n",
+ "4. Run through the training data and use an \"optimizer\" to adjust the variables to fit the data.\n",
+ "\n",
+ "In this tutorial, we'll walk through a trivial example of a simple linear model: `f(x) = x * W + b`, which has two variables - `W` and `b`. Furthermore, we'll synthesize data such that a well trained model would have `W = 3.0` and `b = 2.0`."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "gFzH64Jn9PIm",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "### Define the model\n",
+ "\n",
+ "Let's define a simple class to encapsulate the variables and the computation."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "_WRu7Pze7wk8",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "class Model(object):\n",
+ " def __init__(self):\n",
+ " # Initialize variable to (5.0, 0.0)\n",
+ " # In practice, these should be initialized to random values.\n",
+ " self.W = tfe.Variable(5.0)\n",
+ " self.b = tfe.Variable(0.0)\n",
+ " \n",
+ " def __call__(self, x):\n",
+ " return self.W * x + self.b\n",
+ " \n",
+ "model = Model()\n",
+ "\n",
+ "assert model(3.0).numpy() == 15.0"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "xa6j_yXa-j79",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "### Define a loss function\n",
+ "\n",
+ "A loss function measures how well the output of a model for a given input matches the desired output. Let's use the standard L2 loss."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "Y0ysUFGY924U",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "def loss(predicted_y, desired_y):\n",
+ " return tf.reduce_mean(tf.square(predicted_y - desired_y))"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "qutT_fkl_CBc",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "### Obtain training data\n",
+ "\n",
+ "Let's synthesize the training data with some noise."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "gxPTb-kt_N5m",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "TRUE_W = 3.0\n",
+ "TRUE_b = 2.0\n",
+ "NUM_EXAMPLES = 1000\n",
+ "\n",
+ "inputs = tf.random_normal(shape=[NUM_EXAMPLES])\n",
+ "noise = tf.random_normal(shape=[NUM_EXAMPLES])\n",
+ "outputs = inputs * TRUE_W + TRUE_b + noise"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "-50nq-wPBsAW",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "Before we train the model let's visualize where the model stands right now. We'll plot the model's predictions in red and the training data in blue."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "_eb83LtrB4nt",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "plt.scatter(inputs, outputs, c='b')\n",
+ "plt.scatter(inputs, model(inputs), c='r')\n",
+ "plt.show()\n",
+ "\n",
+ "print('Current loss: '),\n",
+ "print(loss(model(inputs), outputs).numpy())"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "sSDP-yeq_4jE",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "### Define a training loop\n",
+ "\n",
+ "We now have our network and our training data. Let's train it, i.e., use the training data to update the model's variables (`W` and `b`) so that the loss goes down using [gradient descent](https://en.wikipedia.org/wiki/Gradient_descent). There are many variants of the gradient descent scheme that are captured in `tf.train.Optimizer` implementations. We'd highly recommend using those implementations, but in the spirit of building from first principles, in this particular example we will implement the basic math ourselves."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "MBIACgdnA55X",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "def train(model, inputs, outputs, learning_rate):\n",
+ " with tf.GradientTape() as t:\n",
+ " current_loss = loss(model(inputs), outputs)\n",
+ " dW, db = t.gradient(current_loss, [model.W, model.b])\n",
+ " model.W.assign_sub(learning_rate * dW)\n",
+ " model.b.assign_sub(learning_rate * db)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "RwWPaJryD2aN",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "Finally, let's repeatedly run through the training data and see how `W` and `b` evolve."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "XdfkR223D9dW",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "model = Model()\n",
+ "\n",
+ "# Collect the history of W-values and b-values to plot later\n",
+ "Ws, bs = [], []\n",
+ "epochs = range(10)\n",
+ "for epoch in epochs:\n",
+ " Ws.append(model.W.numpy())\n",
+ " bs.append(model.b.numpy())\n",
+ " current_loss = loss(model(inputs), outputs)\n",
+ "\n",
+ " train(model, inputs, outputs, learning_rate=0.1)\n",
+ " print('Epoch %2d: W=%1.2f b=%1.2f, loss=%2.5f' %\n",
+ " (epoch, Ws[-1], bs[-1], current_loss))\n",
+ "\n",
+ "# Let's plot it all\n",
+ "plt.plot(epochs, Ws, 'r',\n",
+ " epochs, bs, 'b')\n",
+ "plt.plot([TRUE_W] * len(epochs), 'r--',\n",
+ " [TRUE_b] * len(epochs), 'b--')\n",
+ "plt.legend(['W', 'b', 'true W', 'true_b'])\n",
+ "plt.show()\n",
+ " "
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "vPnIVuaSJwWz",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Next Steps\n",
+ "\n",
+ "In this tutorial we covered `Variable`s and built and trained a simple linear model using the TensorFlow primitives discussed so far.\n",
+ "\n",
+ "In theory, this is pretty much all you need to use TensorFlow for your machine learning research.\n",
+ "In practice, particularly for neural networks, the higher level APIs like `tf.keras` will be much more convenient since it provides higher level building blocks (called \"layers\"), utilities to save and restore state, a suite of loss functions, a suite of optimization strategies etc. \n",
+ "\n",
+ "The [next tutorial](TODO) will cover these higher level APIs."
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/tensorflow/contrib/eager/python/examples/notebooks/1_basics.ipynb b/tensorflow/contrib/eager/python/examples/notebooks/eager_basics.ipynb
similarity index 50%
rename from tensorflow/contrib/eager/python/examples/notebooks/1_basics.ipynb
rename to tensorflow/contrib/eager/python/examples/notebooks/eager_basics.ipynb
index 51d10a7784..b37a18c9a6 100644
--- a/tensorflow/contrib/eager/python/examples/notebooks/1_basics.ipynb
+++ b/tensorflow/contrib/eager/python/examples/notebooks/eager_basics.ipynb
@@ -1,27 +1,107 @@
{
+ "nbformat": 4,
+ "nbformat_minor": 0,
+ "metadata": {
+ "colab": {
+ "name": "eager_basics.ipynb",
+ "version": "0.3.2",
+ "views": {},
+ "default_view": {},
+ "provenance": [],
+ "private_outputs": true,
+ "collapsed_sections": [],
+ "toc_visible": true
+ },
+ "kernelspec": {
+ "name": "python3",
+ "display_name": "Python 3"
+ }
+ },
"cells": [
{
+ "metadata": {
+ "id": "iPpI7RaYoZuE",
+ "colab_type": "text"
+ },
"cell_type": "markdown",
+ "source": [
+ "##### Copyright 2018 The TensorFlow Authors."
+ ]
+ },
+ {
"metadata": {
- "colab_type": "text",
- "id": "U9i2Dsh-ziXr"
+ "id": "hro2InpHobKk",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ },
+ "cellView": "form"
},
+ "cell_type": "code",
+ "source": [
+ "#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n",
+ "# you may not use this file except in compliance with the License.\n",
+ "# You may obtain a copy of the License at\n",
+ "#\n",
+ "# https://www.apache.org/licenses/LICENSE-2.0\n",
+ "#\n",
+ "# Unless required by applicable law or agreed to in writing, software\n",
+ "# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
+ "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
+ "# See the License for the specific language governing permissions and\n",
+ "# limitations under the License."
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "U9i2Dsh-ziXr",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "# Eager execution basics"
+ ]
+ },
+ {
+ "metadata": {
+ "id": "Hndw-YcxoOJK",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ ""
+ ]
+ },
+ {
+ "metadata": {
+ "id": "6sILUVbHoSgH",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
"source": [
- "# An introduction to TensorFlow\n",
- "\n",
"This is an introductory tutorial for using TensorFlow. It will cover:\n",
"\n",
"* Importing required packages\n",
"* Creating and using Tensors\n",
- "* Using GPU acceleration\n"
+ "* Using GPU acceleration\n",
+ "* Datasets"
]
},
{
- "cell_type": "markdown",
"metadata": {
- "colab_type": "text",
- "id": "z1JcS5iBXMRO"
+ "id": "z1JcS5iBXMRO",
+ "colab_type": "text"
},
+ "cell_type": "markdown",
"source": [
"## Import TensorFlow\n",
"\n",
@@ -30,32 +110,32 @@
]
},
{
- "cell_type": "code",
- "execution_count": 0,
"metadata": {
- "cellView": "code",
+ "id": "RlIWhyeLoYnG",
+ "colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
}
},
- "colab_type": "code",
- "id": "RlIWhyeLoYnG"
+ "cellView": "code"
},
- "outputs": [],
+ "cell_type": "code",
"source": [
"import tensorflow as tf\n",
"\n",
"tf.enable_eager_execution()"
- ]
+ ],
+ "execution_count": 0,
+ "outputs": []
},
{
- "cell_type": "markdown",
"metadata": {
- "colab_type": "text",
- "id": "H9UySOPLXdaw"
+ "id": "H9UySOPLXdaw",
+ "colab_type": "text"
},
+ "cell_type": "markdown",
"source": [
"## Tensors\n",
"\n",
@@ -63,46 +143,18 @@
]
},
{
- "cell_type": "code",
- "execution_count": 0,
"metadata": {
- "cellView": "code",
+ "id": "ngUe237Wt48W",
+ "colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
- },
- "height": 125
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 320,
- "status": "ok",
- "timestamp": 1526420535530,
- "user": {
- "displayName": "",
- "photoUrl": "",
- "userId": ""
- },
- "user_tz": 420
+ }
},
- "id": "ngUe237Wt48W",
- "outputId": "b1a1cd60-4eb3-443d-cd6b-68406390784e"
+ "cellView": "code"
},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "tf.Tensor(3, shape=(), dtype=int32)\n",
- "tf.Tensor([4 6], shape=(2,), dtype=int32)\n",
- "tf.Tensor(25, shape=(), dtype=int32)\n",
- "tf.Tensor(6, shape=(), dtype=int32)\n",
- "tf.Tensor(aGVsbG8gd29ybGQ, shape=(), dtype=string)\n",
- "tf.Tensor(13, shape=(), dtype=int32)\n"
- ]
- }
- ],
+ "cell_type": "code",
"source": [
"print(tf.add(1, 2))\n",
"print(tf.add([1, 2], [3, 4]))\n",
@@ -112,66 +164,46 @@
"\n",
"# Operator overloading is also supported\n",
"print(tf.square(2) + tf.square(3))"
- ]
+ ],
+ "execution_count": 0,
+ "outputs": []
},
{
- "cell_type": "markdown",
"metadata": {
- "colab_type": "text",
- "id": "IDY4WsYRhP81"
+ "id": "IDY4WsYRhP81",
+ "colab_type": "text"
},
+ "cell_type": "markdown",
"source": [
"Each Tensor has a shape and a datatype"
]
},
{
- "cell_type": "code",
- "execution_count": 0,
"metadata": {
+ "id": "srYWH1MdJNG7",
+ "colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
- },
- "height": 53
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 215,
- "status": "ok",
- "timestamp": 1526420538162,
- "user": {
- "displayName": "",
- "photoUrl": "",
- "userId": ""
- },
- "user_tz": 420
- },
- "id": "srYWH1MdJNG7",
- "outputId": "5e4ac41c-5115-4e50-eba0-42e249c16561"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "(1, 2)\n",
- "\u003cdtype: 'int32'\u003e\n"
- ]
+ }
}
- ],
+ },
+ "cell_type": "code",
"source": [
"x = tf.matmul([[1]], [[2, 3]])\n",
"print(x.shape)\n",
"print(x.dtype)"
- ]
+ ],
+ "execution_count": 0,
+ "outputs": []
},
{
- "cell_type": "markdown",
"metadata": {
- "colab_type": "text",
- "id": "eBPw8e8vrsom"
+ "id": "eBPw8e8vrsom",
+ "colab_type": "text"
},
+ "cell_type": "markdown",
"source": [
"The most obvious differences between NumPy arrays and TensorFlow Tensors are:\n",
"\n",
@@ -180,11 +212,11 @@
]
},
{
- "cell_type": "markdown",
"metadata": {
- "colab_type": "text",
- "id": "Dwi1tdW3JBw6"
+ "id": "Dwi1tdW3JBw6",
+ "colab_type": "text"
},
+ "cell_type": "markdown",
"source": [
"### NumPy Compatibility\n",
"\n",
@@ -197,52 +229,17 @@
]
},
{
- "cell_type": "code",
- "execution_count": 0,
"metadata": {
+ "id": "lCUWzso6mbqR",
+ "colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
- },
- "height": 251
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 238,
- "status": "ok",
- "timestamp": 1526420540562,
- "user": {
- "displayName": "",
- "photoUrl": "",
- "userId": ""
- },
- "user_tz": 420
- },
- "id": "lCUWzso6mbqR",
- "outputId": "fd0a22bc-8249-49dd-fcbd-63161cc47e46"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "TensorFlow operations convert numpy arrays to Tensors automatically\n",
- "tf.Tensor(\n",
- "[[ 42. 42. 42.]\n",
- " [ 42. 42. 42.]\n",
- " [ 42. 42. 42.]], shape=(3, 3), dtype=float64)\n",
- "And NumPy operations convert Tensors to numpy arrays automatically\n",
- "[[ 43. 43. 43.]\n",
- " [ 43. 43. 43.]\n",
- " [ 43. 43. 43.]]\n",
- "The .numpy() method explicitly converts a Tensor to a numpy array\n",
- "[[ 42. 42. 42.]\n",
- " [ 42. 42. 42.]\n",
- " [ 42. 42. 42.]]\n"
- ]
+ }
}
- ],
+ },
+ "cell_type": "code",
"source": [
"import numpy as np\n",
"\n",
@@ -258,14 +255,16 @@
"\n",
"print(\"The .numpy() method explicitly converts a Tensor to a numpy array\")\n",
"print(tensor.numpy())"
- ]
+ ],
+ "execution_count": 0,
+ "outputs": []
},
{
- "cell_type": "markdown",
"metadata": {
- "colab_type": "text",
- "id": "PBNP8yTRfu_X"
+ "id": "PBNP8yTRfu_X",
+ "colab_type": "text"
},
+ "cell_type": "markdown",
"source": [
"## GPU acceleration\n",
"\n",
@@ -273,42 +272,18 @@
]
},
{
- "cell_type": "code",
- "execution_count": 0,
"metadata": {
- "cellView": "code",
+ "id": "3Twf_Rw-gQFM",
+ "colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
- },
- "height": 53
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 340,
- "status": "ok",
- "timestamp": 1526420543562,
- "user": {
- "displayName": "",
- "photoUrl": "",
- "userId": ""
- },
- "user_tz": 420
+ }
},
- "id": "3Twf_Rw-gQFM",
- "outputId": "2239ae2b-adf3-4895-b1f3-464cf5361d1b"
+ "cellView": "code"
},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Is there a GPU available: False\n",
- "Is the Tensor on GPU #0: False\n"
- ]
- }
- ],
+ "cell_type": "code",
"source": [
"x = tf.random_uniform([3, 3])\n",
"\n",
@@ -317,26 +292,28 @@
"\n",
"print(\"Is the Tensor on GPU #0: \"),\n",
"print(x.device.endswith('GPU:0'))"
- ]
+ ],
+ "execution_count": 0,
+ "outputs": []
},
{
- "cell_type": "markdown",
"metadata": {
- "colab_type": "text",
- "id": "vpgYzgVXW2Ud"
+ "id": "vpgYzgVXW2Ud",
+ "colab_type": "text"
},
+ "cell_type": "markdown",
"source": [
"### Device Names\n",
"\n",
- "The `Tensor.device` property provides a fully qualified string name of the device hosting the contents of the Tensor. This name encodes a bunch of details, such as an identifier of the network address of the host on which this program is executing and the device within that host. This is required for distributed execution of TensorFlow programs, but we'll skip that for now. The string will end with `GPU:\u003cN\u003e` if the tensor is placed on the `N`-th tensor on the host."
+ "The `Tensor.device` property provides a fully qualified string name of the device hosting the contents of the Tensor. This name encodes a bunch of details, such as an identifier of the network address of the host on which this program is executing and the device within that host. This is required for distributed execution of TensorFlow programs, but we'll skip that for now. The string will end with `GPU:` if the tensor is placed on the `N`-th tensor on the host."
]
},
{
- "cell_type": "markdown",
"metadata": {
- "colab_type": "text",
- "id": "ZWZQCimzuqyP"
+ "id": "ZWZQCimzuqyP",
+ "colab_type": "text"
},
+ "cell_type": "markdown",
"source": [
"\n",
"\n",
@@ -346,41 +323,17 @@
]
},
{
- "cell_type": "code",
- "execution_count": 0,
"metadata": {
+ "id": "RjkNZTuauy-Q",
+ "colab_type": "code",
"colab": {
"autoexec": {
"startup": false,
"wait_interval": 0
- },
- "height": 53
- },
- "colab_type": "code",
- "executionInfo": {
- "elapsed": 1762,
- "status": "ok",
- "timestamp": 1526420547562,
- "user": {
- "displayName": "",
- "photoUrl": "",
- "userId": ""
- },
- "user_tz": 420
- },
- "id": "RjkNZTuauy-Q",
- "outputId": "2e613293-ccac-4db2-b793-8ceb5b5adcfd"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "On CPU:\n",
- "10 loops, best of 3: 35.8 ms per loop\n"
- ]
+ }
}
- ],
+ },
+ "cell_type": "code",
"source": [
"def time_matmul(x):\n",
" %timeit tf.matmul(x, x)\n",
@@ -398,32 +351,141 @@
" x = tf.random_uniform([1000, 1000])\n",
" assert x.device.endswith(\"GPU:0\")\n",
" time_matmul(x)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "o1K4dlhhHtQj",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "## Datasets\n",
+ "\n",
+ "This section demonstrates the use of the [`tf.data.Dataset` API](https://www.tensorflow.org/guide/datasets) to build pipelines to feed data to your model. It covers:\n",
+ "\n",
+ "* Creating a `Dataset`.\n",
+ "* Iteration over a `Dataset` with eager execution enabled.\n",
+ "\n",
+ "We recommend using the `Dataset`s API for building performant, complex input pipelines from simple, re-usable pieces that will feed your model's training or evaluation loops.\n",
+ "\n",
+ "If you're familiar with TensorFlow graphs, the API for constructing the `Dataset` object remains exactly the same when eager execution is enabled, but the process of iterating over elements of the dataset is slightly simpler.\n",
+ "You can use Python iteration over the `tf.data.Dataset` object and do not need to explicitly create an `tf.data.Iterator` object.\n",
+ "As a result, the discussion on iterators in the [TensorFlow Guide](https://www.tensorflow.org/guide/datasets) is not relevant when eager execution is enabled."
]
},
{
+ "metadata": {
+ "id": "zI0fmOynH-Ne",
+ "colab_type": "text"
+ },
"cell_type": "markdown",
+ "source": [
+ "### Create a source `Dataset`\n",
+ "\n",
+ "Create a _source_ dataset using one of the factory functions like [`Dataset.from_tensors`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#from_tensors), [`Dataset.from_tensor_slices`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#from_tensor_slices) or using objects that read from files like [`TextLineDataset`](https://www.tensorflow.org/api_docs/python/tf/data/TextLineDataset) or [`TFRecordDataset`](https://www.tensorflow.org/api_docs/python/tf/data/TFRecordDataset). See the [TensorFlow Guide](https://www.tensorflow.org/guide/datasets#reading_input_data) for more information."
+ ]
+ },
+ {
"metadata": {
- "colab_type": "text",
- "id": "YEOJTNiOvnpQ"
+ "id": "F04fVOHQIBiG",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
},
+ "cell_type": "code",
"source": [
- "## Next Steps\n",
+ "ds_tensors = tf.data.Dataset.from_tensor_slices([1, 2, 3, 4, 5, 6])\n",
"\n",
- "In this tutorial we covered the most fundamental concepts in TensorFlow - `Tensor`s, operations, and devices.\n",
- "In [the next tutorial](https://github.com/tensorflow/models/tree/master/official/contrib/eager/python/examples/notebooks/2_gradients.ipynb) we will cover automatic differentiation - a building block required for training many machine learning models like neural networks."
+ "# Create a CSV file\n",
+ "import tempfile\n",
+ "_, filename = tempfile.mkstemp()\n",
+ "\n",
+ "with open(filename, 'w') as f:\n",
+ " f.write(\"\"\"Line 1\n",
+ "Line 2\n",
+ "Line 3\n",
+ " \"\"\")\n",
+ "\n",
+ "ds_file = tf.data.TextLineDataset(filename)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "vbxIhC-5IPdf",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "### Apply transformations\n",
+ "\n",
+ "Use the transformations functions like [`map`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#map), [`batch`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#batch), [`shuffle`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#shuffle) etc. to apply transformations to the records of the dataset. See the [API documentation for `tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset) for details."
]
+ },
+ {
+ "metadata": {
+ "id": "uXSDZWE-ISsd",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "ds_tensors = ds_tensors.map(tf.square).shuffle(2).batch(2)\n",
+ "\n",
+ "ds_file = ds_file.batch(2)"
+ ],
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "metadata": {
+ "id": "A8X1GNfoIZKJ",
+ "colab_type": "text"
+ },
+ "cell_type": "markdown",
+ "source": [
+ "### Iterate\n",
+ "\n",
+ "When eager execution is enabled `Dataset` objects support iteration.\n",
+ "If you're familiar with the use of `Dataset`s in TensorFlow graphs, note that there is no need for calls to `Dataset.make_one_shot_iterator()` or `get_next()` calls."
+ ]
+ },
+ {
+ "metadata": {
+ "id": "ws-WKRk5Ic6-",
+ "colab_type": "code",
+ "colab": {
+ "autoexec": {
+ "startup": false,
+ "wait_interval": 0
+ }
+ }
+ },
+ "cell_type": "code",
+ "source": [
+ "print('Elements of ds_tensors:')\n",
+ "for x in ds_tensors:\n",
+ " print(x)\n",
+ "\n",
+ "print('\\nElements in ds_file:')\n",
+ "for x in ds_file:\n",
+ " print(x)"
+ ],
+ "execution_count": 0,
+ "outputs": []
}
- ],
- "metadata": {
- "colab": {
- "collapsed_sections": [],
- "default_view": {},
- "name": "TensorFlow: An introduction",
- "provenance": [],
- "version": "0.3.2",
- "views": {}
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
+ ]
+}
\ No newline at end of file
--
GitLab
From 2b13b7ac7253e6f0d7d96855b1b3e7fee49277a7 Mon Sep 17 00:00:00 2001
From: Billy Lamberta
Date: Tue, 3 Jul 2018 16:40:14 -0700
Subject: [PATCH 074/519] Update docs_src in 1.9 to match master
---
tensorflow/docs_src/community/leftnav_files | 1 -
tensorflow/docs_src/community/swift.md | 60 ------
tensorflow/docs_src/get_started/eager.md | 3 -
tensorflow/docs_src/get_started/leftnav_files | 10 -
.../docs_src/guide/custom_estimators.md | 8 +-
.../docs_src/guide/datasets_for_estimators.md | 6 +-
tensorflow/docs_src/guide/debugger.md | 30 ++-
tensorflow/docs_src/guide/eager.md | 12 +-
tensorflow/docs_src/guide/graphs.md | 2 +-
tensorflow/docs_src/guide/keras.md | 24 ++-
tensorflow/docs_src/guide/saved_model.md | 9 +-
.../docs_src/guide/tensorboard_histograms.md | 4 +-
tensorflow/docs_src/install/install_c.md | 2 +-
tensorflow/docs_src/install/install_go.md | 2 +-
tensorflow/docs_src/install/install_java.md | 24 +--
tensorflow/docs_src/install/install_linux.md | 24 ++-
tensorflow/docs_src/install/install_mac.md | 13 +-
.../docs_src/install/install_raspbian.md | 2 +-
.../docs_src/install/install_sources.md | 36 ++--
.../docs_src/install/install_windows.md | 2 +-
tensorflow/docs_src/mobile/leftnav_files | 1 +
tensorflow/docs_src/mobile/linking_libs.md | 2 +-
tensorflow/docs_src/mobile/mobile_intro.md | 3 +-
tensorflow/docs_src/mobile/prepare_models.md | 4 +-
.../docs_src/mobile/tflite/demo_android.md | 24 +--
tensorflow/docs_src/mobile/tflite/devguide.md | 9 +-
tensorflow/docs_src/mobile/tflite/index.md | 17 +-
.../docs_src/mobile/tflite/performance.md | 174 ++++++++++++++++++
.../docs_src/performance/quantization.md | 2 +-
.../performance/xla/operation_semantics.md | 39 +++-
.../{get_started => tutorials}/_index.yaml | 44 ++---
tensorflow/docs_src/tutorials/_toc.yaml | 93 ++++++++++
.../eager/custom_training_walkthrough.md | 3 +
tensorflow/docs_src/tutorials/eager/index.md | 13 ++
.../docs_src/tutorials/image_retraining.md | 4 -
.../tutorials/{ => images}/deep_cnn.md | 8 +-
.../{ => images}/image_recognition.md | 1 -
.../docs_src/tutorials/{ => images}/layers.md | 47 +----
tensorflow/docs_src/tutorials/index.md | 59 ------
.../keras}/basic_classification.md | 0
.../keras}/basic_regression.md | 0
.../keras}/basic_text_classification.md | 0
tensorflow/docs_src/tutorials/keras/index.md | 22 +++
.../keras}/overfit_and_underfit.md | 0
.../keras}/save_and_restore_models.md | 0
tensorflow/docs_src/tutorials/leftnav_files | 23 ---
.../{get_started => tutorials}/next_steps.md | 0
.../tutorials/{ => non-ml}/mandelbrot.md | 0
.../docs_src/tutorials/{ => non-ml}/pdes.md | 3 +-
.../{ => representation}/kernel_methods.md | 2 +-
.../tutorials/{ => representation}/linear.md | 0
.../tutorials/{ => representation}/wide.md | 0
.../{ => representation}/wide_and_deep.md | 0
.../{ => representation}/word2vec.md | 0
tensorflow/docs_src/tutorials/seq2seq.md | 5 -
.../{ => sequences}/audio_recognition.md | 0
.../tutorials/{ => sequences}/recurrent.md | 4 +-
.../{ => sequences}/recurrent_quickdraw.md | 4 +-
58 files changed, 521 insertions(+), 363 deletions(-)
delete mode 100644 tensorflow/docs_src/community/swift.md
delete mode 100644 tensorflow/docs_src/get_started/eager.md
delete mode 100644 tensorflow/docs_src/get_started/leftnav_files
create mode 100644 tensorflow/docs_src/mobile/tflite/performance.md
rename tensorflow/docs_src/{get_started => tutorials}/_index.yaml (77%)
create mode 100644 tensorflow/docs_src/tutorials/_toc.yaml
create mode 100644 tensorflow/docs_src/tutorials/eager/custom_training_walkthrough.md
create mode 100644 tensorflow/docs_src/tutorials/eager/index.md
delete mode 100644 tensorflow/docs_src/tutorials/image_retraining.md
rename tensorflow/docs_src/tutorials/{ => images}/deep_cnn.md (98%)
rename tensorflow/docs_src/tutorials/{ => images}/image_recognition.md (99%)
rename tensorflow/docs_src/tutorials/{ => images}/layers.md (94%)
delete mode 100644 tensorflow/docs_src/tutorials/index.md
rename tensorflow/docs_src/{get_started => tutorials/keras}/basic_classification.md (100%)
rename tensorflow/docs_src/{get_started => tutorials/keras}/basic_regression.md (100%)
rename tensorflow/docs_src/{get_started => tutorials/keras}/basic_text_classification.md (100%)
create mode 100644 tensorflow/docs_src/tutorials/keras/index.md
rename tensorflow/docs_src/{get_started => tutorials/keras}/overfit_and_underfit.md (100%)
rename tensorflow/docs_src/{get_started => tutorials/keras}/save_and_restore_models.md (100%)
delete mode 100644 tensorflow/docs_src/tutorials/leftnav_files
rename tensorflow/docs_src/{get_started => tutorials}/next_steps.md (100%)
rename tensorflow/docs_src/tutorials/{ => non-ml}/mandelbrot.md (100%)
mode change 100755 => 100644
rename tensorflow/docs_src/tutorials/{ => non-ml}/pdes.md (98%)
mode change 100755 => 100644
rename tensorflow/docs_src/tutorials/{ => representation}/kernel_methods.md (99%)
rename tensorflow/docs_src/tutorials/{ => representation}/linear.md (100%)
rename tensorflow/docs_src/tutorials/{ => representation}/wide.md (100%)
rename tensorflow/docs_src/tutorials/{ => representation}/wide_and_deep.md (100%)
rename tensorflow/docs_src/tutorials/{ => representation}/word2vec.md (100%)
delete mode 100644 tensorflow/docs_src/tutorials/seq2seq.md
rename tensorflow/docs_src/tutorials/{ => sequences}/audio_recognition.md (100%)
rename tensorflow/docs_src/tutorials/{ => sequences}/recurrent.md (98%)
rename tensorflow/docs_src/tutorials/{ => sequences}/recurrent_quickdraw.md (98%)
diff --git a/tensorflow/docs_src/community/leftnav_files b/tensorflow/docs_src/community/leftnav_files
index 2bae60d9dd..0bd1f14de9 100644
--- a/tensorflow/docs_src/community/leftnav_files
+++ b/tensorflow/docs_src/community/leftnav_files
@@ -6,4 +6,3 @@ groups.md
documentation.md
style_guide.md
benchmarks.md
-swift.md
diff --git a/tensorflow/docs_src/community/swift.md b/tensorflow/docs_src/community/swift.md
deleted file mode 100644
index d1625d3b93..0000000000
--- a/tensorflow/docs_src/community/swift.md
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-# Swift for TensorFlow
-
-Welcome to the Swift for TensorFlow development community!
-
-Swift for TensorFlow is a new way to develop machine learning models. It
-gives you the power of
-[TensorFlow](https://www.tensorflow.org) directly
-integrated into the [Swift programming language](https://swift.org/about).
-With Swift, you can write the following imperative code, and Swift
-automatically turns it into **a single TensorFlow Graph** and runs it
-with the full performance of TensorFlow Sessions on CPU, GPU and
-[TPU](https://cloud.google.com/tpu/docs/tpus).
-
-```swift
-import TensorFlow
-
-var x = Tensor([[1, 2], [3, 4]])
-
-for i in 1...5 {
- x += x ⊗ x
-}
-
-print(x)
-```
-
-Swift combines the flexibility of
-[Eager Execution](https://www.tensorflow.org/programmers_guide/eager) with the
-high performance of [Graphs and Sessions](https://www.tensorflow.org/programmers_guide/graphs).
-Behind the scenes, Swift analyzes your Tensor code and automatically builds
-graphs for you. Swift also catches type errors and shape mismatches before
-running your code, and has [Automatic Differentiation](https://en.wikipedia.org/wiki/Automatic_differentiation)
-built right in. We believe that machine learning tools are so important that
-they deserve **a first-class language and a compiler**.
-
-Note: Swift for TensorFlow is an early stage research project. It has been
-released to enable open source development and is not yet ready for general use
-by machine learning developers.
-
-## Open Source
-
-We have released Swift for TensorFlow as an open-source project on GitHub!
-
-Our [documentation repository](https://github.com/tensorflow/swift) contains a
-[project overview](https://github.com/tensorflow/swift/blob/master/docs/DesignOverview.md)
-and [technical papers](https://github.com/tensorflow/swift/tree/master/docs)
-explaining specific areas in depth. There are also instructions for [installing
-pre-built packages](https://github.com/tensorflow/swift/blob/master/Installation.md)
-(for macOS and Ubuntu) as well as a simple
-[usage tutorial](https://github.com/tensorflow/swift/blob/master/Usage.md).
-
-Moving forward, we will use an open design model and all discussions will be
-public.
-
-[Sign up here to join the community Google
-group](https://groups.google.com/a/tensorflow.org/d/forum/swift), which we will
-use for announcements and general discussion.
diff --git a/tensorflow/docs_src/get_started/eager.md b/tensorflow/docs_src/get_started/eager.md
deleted file mode 100644
index ddf239485a..0000000000
--- a/tensorflow/docs_src/get_started/eager.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Custom Training Walkthrough
-
-[Colab notebook](https://colab.research.google.com/github/tensorflow/models/blob/r1.9.0/samples/core/get_started/eager.ipynb)
diff --git a/tensorflow/docs_src/get_started/leftnav_files b/tensorflow/docs_src/get_started/leftnav_files
deleted file mode 100644
index 99d2b2c3e1..0000000000
--- a/tensorflow/docs_src/get_started/leftnav_files
+++ /dev/null
@@ -1,10 +0,0 @@
-### Learn and use ML
-basic_classification.md: Basic classification
-basic_text_classification.md: Text classification
-basic_regression.md: Regression
-overfit_and_underfit.md
-save_and_restore_models.md
-next_steps.md
-
-### Research and experimentation
-eager.md
diff --git a/tensorflow/docs_src/guide/custom_estimators.md b/tensorflow/docs_src/guide/custom_estimators.md
index fb20b35c12..a63e2bafb3 100644
--- a/tensorflow/docs_src/guide/custom_estimators.md
+++ b/tensorflow/docs_src/guide/custom_estimators.md
@@ -362,10 +362,10 @@ model's loss. This is the
that will be optimized.
We can calculate the loss by calling @{tf.losses.sparse_softmax_cross_entropy}.
-The value returned by this function will be lowest, approximately 0,
-probability of the correct class (at index `label`) is near 1.0. The loss value
-returned is progressively larger as the probability of the correct class
-decreases.
+The value returned by this function will be approximately 0 at lowest,
+when the probability of the correct class (at index `label`) is near 1.0.
+The loss value returned is progressively larger as the probability of the
+correct class decreases.
This function returns the average over the whole batch.
diff --git a/tensorflow/docs_src/guide/datasets_for_estimators.md b/tensorflow/docs_src/guide/datasets_for_estimators.md
index b04af78cd8..b55a5731a4 100644
--- a/tensorflow/docs_src/guide/datasets_for_estimators.md
+++ b/tensorflow/docs_src/guide/datasets_for_estimators.md
@@ -76,9 +76,9 @@ Let's walk through the `train_input_fn()`.
The function starts by using the @{tf.data.Dataset.from_tensor_slices} function
to create a @{tf.data.Dataset} representing slices of the array. The array is
sliced across the first dimension. For example, an array containing the
-@{$tutorials/layers$mnist training data} has a shape of `(60000, 28, 28)`.
-Passing this to `from_tensor_slices` returns a `Dataset` object containing
-60000 slices, each one a 28x28 image.
+MNIST training data has a shape of `(60000, 28, 28)`. Passing this to
+`from_tensor_slices` returns a `Dataset` object containing 60000 slices, each one
+a 28x28 image.
The code that returns this `Dataset` is as follows:
diff --git a/tensorflow/docs_src/guide/debugger.md b/tensorflow/docs_src/guide/debugger.md
index 6bd941886d..8d78fe6fbd 100644
--- a/tensorflow/docs_src/guide/debugger.md
+++ b/tensorflow/docs_src/guide/debugger.md
@@ -17,7 +17,7 @@ how to use the graphical user interface (GUI) of tfdbg, i.e., the
Note: The TensorFlow debugger uses a
[curses](https://en.wikipedia.org/wiki/Curses_\(programming_library\))-based text
user interface. On Mac OS X, the `ncurses` library is required and can be
-installed with `brew install homebrew/dupes/ncurses`. On Windows, curses isn't as
+installed with `brew install ncurses`. On Windows, curses isn't as
well supported, so a [readline](https://en.wikipedia.org/wiki/GNU_Readline)-based
interface can be used with tfdbg by installing `pyreadline` with `pip`. If you
use Anaconda3, you can install it with a command such as
@@ -33,8 +33,9 @@ and [`inf`s](https://en.wikipedia.org/wiki/Infinity), a frequently-encountered
type of bug in TensorFlow model development.
The following example is for users who use the low-level
[`Session`](https://www.tensorflow.org/api_docs/python/tf/Session) API of
-TensorFlow. A later section of this document describes how to use **tfdbg**
-with a higher-level API, namely `Estimator`s.
+TensorFlow. Later sections of this document describe how to use **tfdbg**
+with higher-level APIs of TensorFlow, including `tf.estimator`,
+`tf.keras` / `keras` and `tf.contrib.slim`.
To *observe* such an issue, run the following command without the debugger (the
source code can be found
[here](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/debug/examples/debug_mnist.py)):
@@ -209,6 +210,7 @@ Try the following commands at the `tfdbg>` prompt (referencing the code at
| **`config`** | | **Set or show persistent TFDBG UI configuration.** | |
| | `set` | Set the value of a config item: {`graph_recursion_depth`, `mouse_mode`}. | `config set graph_recursion_depth 3` |
| | `show` | Show current persistent UI configuration. | `config show` |
+| **`version`** | | **Print the version of TensorFlow and its key dependencies.** | `version` |
| **`help`** | | **Print general help information** | `help` |
| | `help ` | Print help for given command. | `help lt` |
@@ -461,7 +463,6 @@ predict_results = classifier.predict(predict_input_fn, hooks=hooks)
```
[debug_tflearn_iris.py](https://www.tensorflow.org/code/tensorflow/python/debug/examples/debug_tflearn_iris.py),
-based on [tf-learn's iris tutorial](https://www.tensorflow.org/versions/r1.8/get_started/tflearn),
contains a full example of how to use the tfdbg with `Estimator`s.
To run this example, do:
@@ -477,20 +478,31 @@ for more details.
## Debugging Keras Models with TFDBG
-To use TFDBG with [Keras](https://keras.io/), let the Keras backend use
-a TFDBG-wrapped Session object. For example, to use the CLI wrapper:
+To use TFDBG with
+[tf.keras](https://www.tensorflow.org/api_docs/python/tf/keras),
+let the Keras backend use a TFDBG-wrapped Session object. For example, to use
+the CLI wrapper:
``` python
import tensorflow as tf
-from keras import backend as keras_backend
from tensorflow.python import debug as tf_debug
-keras_backend.set_session(tf_debug.LocalCLIDebugWrapperSession(tf.Session()))
+tf.keras.backend.set_session(tf_debug.LocalCLIDebugWrapperSession(tf.Session()))
# Define your keras model, called "model".
-model.fit(...) # This will break into the TFDBG CLI.
+
+# Calls to `fit()`, 'evaluate()` and `predict()` methods will break into the
+# TFDBG CLI.
+model.fit(...)
+model.evaluate(...)
+model.predict(...)
```
+With minor modification, the preceding code example also works for the
+[non-TensorFlow version of Keras](https://keras.io/) running against a
+TensorFlow backend. You just need to replace `tf.keras.backend` with
+`keras.backend`.
+
## Debugging tf-slim with TFDBG
TFDBG supports debugging of training and evaluation with
diff --git a/tensorflow/docs_src/guide/eager.md b/tensorflow/docs_src/guide/eager.md
index 00d02b4455..003ca265fe 100644
--- a/tensorflow/docs_src/guide/eager.md
+++ b/tensorflow/docs_src/guide/eager.md
@@ -149,16 +149,17 @@ it to implement your own layer:
```py
class MySimpleLayer(tf.keras.layers.Layer):
def __init__(self, output_units):
+ super(MySimpleLayer, self).__init__()
self.output_units = output_units
- def build(self, input):
+ def build(self, input_shape):
# The build method gets called the first time your layer is used.
# Creating variables on build() allows you to make their shape depend
- # on the input shape and hence remove the need for the user to specify
+ # on the input shape and hence removes the need for the user to specify
# full shapes. It is possible to create variables during __init__() if
# you already know their full shapes.
self.kernel = self.add_variable(
- "kernel", [input.shape[-1], self.output_units])
+ "kernel", [input_shape[-1], self.output_units])
def call(self, input):
# Override call() instead of __call__ so we can perform some bookkeeping.
@@ -315,9 +316,8 @@ for (batch, (images, labels)) in enumerate(dataset):
The following example creates a multi-layer model that classifies the standard
-[MNIST handwritten digits](https://www.tensorflow.org/tutorials/layers). It
-demonstrates the optimizer and layer APIs to build trainable graphs in an eager
-execution environment.
+MNIST handwritten digits. It demonstrates the optimizer and layer APIs to build
+trainable graphs in an eager execution environment.
### Train a model
diff --git a/tensorflow/docs_src/guide/graphs.md b/tensorflow/docs_src/guide/graphs.md
index e6246ef148..492f97c191 100644
--- a/tensorflow/docs_src/guide/graphs.md
+++ b/tensorflow/docs_src/guide/graphs.md
@@ -486,7 +486,7 @@ subgraph inside.

For more information about visualizing your TensorFlow application with
-TensorBoard, see the [TensorBoard tutorial](../get_started/summaries_and_tensorboard.md).
+TensorBoard, see the [TensorBoard guide](./summaries_and_tensorboard.md).
## Programming with multiple graphs
diff --git a/tensorflow/docs_src/guide/keras.md b/tensorflow/docs_src/guide/keras.md
index d584ebe945..1d846df104 100644
--- a/tensorflow/docs_src/guide/keras.md
+++ b/tensorflow/docs_src/guide/keras.md
@@ -221,7 +221,7 @@ To *evaluate* the inference-mode loss and metrics for the data provided:
```python
model.evaluate(x, y, batch_size=32)
-model.evaluate(dataset, steps=30
+model.evaluate(dataset, steps=30)
```
And to *predict* the output of the last layer in inference for the data provided,
@@ -548,11 +548,9 @@ model.compile(optimizer=tf.train.RMSPropOptimizer(0.001),
estimator = keras.estimator.model_to_estimator(model)
```
-Note:
-* Enable [eager execution](./eager.md) for debugging
+Note: Enable [eager execution](./eager.md) for debugging
[Estimator input functions](./premade_estimators.md#create_input_functions)
and inspecting data.
-* Don't use batch normalization or try to finetune batch normalization models with estimators created from `tf.keras.estimator.model_to_estimator`. More details at [#17950](https://github.com/tensorflow/tensorflow/issues/17950)
### Multiple GPUs
@@ -583,15 +581,6 @@ model.compile(loss='binary_crossentropy', optimizer=optimizer)
model.summary()
```
-Convert the Keras model to a `tf.estimator.Estimator` instance:
-
-```python
-keras_estimator = keras.estimator.model_to_estimator(
- keras_model=model,
- config=config,
- model_dir='/tmp/model_dir')
-```
-
Define an *input pipeline*. The `input_fn` returns a `tf.data.Dataset` object
used to distribute the data across multiple devices—with each device processing
a slice of the input batch.
@@ -617,6 +606,15 @@ strategy = tf.contrib.distribute.MirroredStrategy()
config = tf.estimator.RunConfig(train_distribute=strategy)
```
+Convert the Keras model to a `tf.estimator.Estimator` instance:
+
+```python
+keras_estimator = keras.estimator.model_to_estimator(
+ keras_model=model,
+ config=config,
+ model_dir='/tmp/model_dir')
+```
+
Finally, train the `Estimator` instance by providing the `input_fn` and `steps`
arguments:
diff --git a/tensorflow/docs_src/guide/saved_model.md b/tensorflow/docs_src/guide/saved_model.md
index 27ef7bb0da..acc3d3ca0b 100644
--- a/tensorflow/docs_src/guide/saved_model.md
+++ b/tensorflow/docs_src/guide/saved_model.md
@@ -794,11 +794,12 @@ Here's the syntax:
```
usage: saved_model_cli run [-h] --dir DIR --tag_set TAG_SET --signature_def
SIGNATURE_DEF_KEY [--inputs INPUTS]
- [--input_exprs INPUT_EXPRS] [--outdir OUTDIR]
+ [--input_exprs INPUT_EXPRS]
+ [--input_examples INPUT_EXAMPLES] [--outdir OUTDIR]
[--overwrite] [--tf_debug]
```
-The `run` command provides the following two ways to pass inputs to the model:
+The `run` command provides the following three ways to pass inputs to the model:
* `--inputs` option enables you to pass numpy ndarray in files.
* `--input_exprs` option enables you to pass Python expressions.
@@ -847,7 +848,7 @@ dictionary is stored in the pickle file and the value corresponding to
the *variable_name* will be used.
-#### `--inputs_exprs`
+#### `--input_exprs`
To pass inputs through Python expressions, specify the `--input_exprs` option.
This can be useful for when you don't have data
@@ -869,7 +870,7 @@ example:
(Note that the `numpy` module is already available to you as `np`.)
-#### `--inputs_examples`
+#### `--input_examples`
To pass `tf.train.Example` as inputs, specify the `--input_examples` option.
For each input key, it takes a list of dictionary, where each dictionary is an
diff --git a/tensorflow/docs_src/guide/tensorboard_histograms.md b/tensorflow/docs_src/guide/tensorboard_histograms.md
index 918deda190..af8f2cadd1 100644
--- a/tensorflow/docs_src/guide/tensorboard_histograms.md
+++ b/tensorflow/docs_src/guide/tensorboard_histograms.md
@@ -13,8 +13,8 @@ TensorFlow has an op
which is perfect for this purpose. As is usually the case with TensorBoard, we
will ingest data using a summary op; in this case,
['tf.summary.histogram'](https://www.tensorflow.org/api_docs/python/tf/summary/histogram).
-For a primer on how summaries work, please see the general
-[TensorBoard tutorial](https://www.tensorflow.org/get_started/summaries_and_tensorboard).
+For a primer on how summaries work, please see the
+[TensorBoard guide](./summaries_and_tensorboard.md).
Here is a code snippet that will generate some histogram summaries containing
normally distributed data, where the mean of the distribution increases over
diff --git a/tensorflow/docs_src/install/install_c.md b/tensorflow/docs_src/install/install_c.md
index 9aebf2bfa4..2901848745 100644
--- a/tensorflow/docs_src/install/install_c.md
+++ b/tensorflow/docs_src/install/install_c.md
@@ -38,7 +38,7 @@ enable TensorFlow for C:
OS="linux" # Change to "darwin" for macOS
TARGET_DIRECTORY="/usr/local"
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-${OS}-x86_64-1.9.0-rc2.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-${OS}-x86_64-1.9.0-rc0.tar.gz" |
sudo tar -C $TARGET_DIRECTORY -xz
The `tar` command extracts the TensorFlow C library into the `lib`
diff --git a/tensorflow/docs_src/install/install_go.md b/tensorflow/docs_src/install/install_go.md
index 1907355341..2c126df5aa 100644
--- a/tensorflow/docs_src/install/install_go.md
+++ b/tensorflow/docs_src/install/install_go.md
@@ -38,7 +38,7 @@ steps to install this library and enable TensorFlow for Go:
TF_TYPE="cpu" # Change to "gpu" for GPU support
TARGET_DIRECTORY='/usr/local'
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-$(go env GOOS)-x86_64-1.9.0-rc2.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-$(go env GOOS)-x86_64-1.9.0-rc0.tar.gz" |
sudo tar -C $TARGET_DIRECTORY -xz
The `tar` command extracts the TensorFlow C library into the `lib`
diff --git a/tensorflow/docs_src/install/install_java.md b/tensorflow/docs_src/install/install_java.md
index b9c9912816..692dfc9cef 100644
--- a/tensorflow/docs_src/install/install_java.md
+++ b/tensorflow/docs_src/install/install_java.md
@@ -36,7 +36,7 @@ following to the project's `pom.xml` to use the TensorFlow Java APIs:
org.tensorflow
tensorflow
- 1.9.0-rc2
+ 1.9.0-rc0
```
@@ -65,7 +65,7 @@ As an example, these steps will create a Maven project that uses TensorFlow:
org.tensorflow
tensorflow
- 1.9.0-rc2
+ 1.9.0-rc0
@@ -124,12 +124,12 @@ instead:
org.tensorflow
libtensorflow
- 1.9.0-rc2
+ 1.9.0-rc0
org.tensorflow
libtensorflow_jni_gpu
- 1.9.0-rc2
+ 1.9.0-rc0
```
@@ -148,7 +148,7 @@ refer to the simpler instructions above instead.
Take the following steps to install TensorFlow for Java on Linux or macOS:
1. Download
- [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc2.jar),
+ [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc0.jar),
which is the TensorFlow Java Archive (JAR).
2. Decide whether you will run TensorFlow for Java on CPU(s) only or with
@@ -167,7 +167,7 @@ Take the following steps to install TensorFlow for Java on Linux or macOS:
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
mkdir -p ./jni
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-${TF_TYPE}-${OS}-x86_64-1.9.0-rc2.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-${TF_TYPE}-${OS}-x86_64-1.9.0-rc0.tar.gz" |
tar -xz -C ./jni
### Install on Windows
@@ -175,13 +175,13 @@ Take the following steps to install TensorFlow for Java on Linux or macOS:
Take the following steps to install TensorFlow for Java on Windows:
1. Download
- [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc2.jar),
+ [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc0.jar),
which is the TensorFlow Java Archive (JAR).
2. Download the following Java Native Interface (JNI) file appropriate for
- [TensorFlow for Java on Windows](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-cpu-windows-x86_64-1.9.0-rc2.zip).
+ [TensorFlow for Java on Windows](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-cpu-windows-x86_64-1.9.0-rc0.zip).
3. Extract this .zip file.
-
+__Note__: The native library (`tensorflow_jni.dll`) requires `msvcp140.dll` at runtime, which is included in the [Visual C++ 2015 Redistributable](https://www.microsoft.com/en-us/download/details.aspx?id=48145) package.
### Validate the installation
@@ -227,7 +227,7 @@ must be part of your `classpath`. For example, you can include the
downloaded `.jar` in your `classpath` by using the `-cp` compilation flag
as follows:
-javac -cp libtensorflow-1.9.0-rc2.jar HelloTF.java
+javac -cp libtensorflow-1.9.0-rc0.jar HelloTF.java
### Running
@@ -241,11 +241,11 @@ two files are available to the JVM:
For example, the following command line executes the `HelloTF` program on Linux
and macOS X:
-java -cp libtensorflow-1.9.0-rc2.jar:. -Djava.library.path=./jni HelloTF
+java -cp libtensorflow-1.9.0-rc0.jar:. -Djava.library.path=./jni HelloTF
And the following command line executes the `HelloTF` program on Windows:
-java -cp libtensorflow-1.9.0-rc2.jar;. -Djava.library.path=jni HelloTF
+java -cp libtensorflow-1.9.0-rc0.jar;. -Djava.library.path=jni HelloTF
If the program prints Hello from version, you've successfully
installed TensorFlow for Java and are ready to use the API. If the program
diff --git a/tensorflow/docs_src/install/install_linux.md b/tensorflow/docs_src/install/install_linux.md
index ae3d50ff39..f21c073a1b 100644
--- a/tensorflow/docs_src/install/install_linux.md
+++ b/tensorflow/docs_src/install/install_linux.md
@@ -339,9 +339,7 @@ Docker will download the TensorFlow binary image the first time you launch it.
#### GPU support
-Prior to installing TensorFlow with GPU support, ensure that your system meets all
-[NVIDIA software requirements](#NVIDIARequirements). To launch a Docker container
-with NVidia GPU support, enter a command of the following format:
+To launch a Docker container with NVidia GPU support, enter a command of the following format (this [does not require any local CUDA installation](https://github.com/nvidia/nvidia-docker/wiki/CUDA#requirements)):
$ nvidia-docker run -it -p hostPort:containerPort TensorFlowGPUImage
@@ -438,7 +436,7 @@ Take the following steps to install TensorFlow in an Anaconda environment:
(tensorflow)$ pip install --ignore-installed --upgrade \
- https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp34-cp34m-linux_x86_64.whl
+ https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp34-cp34m-linux_x86_64.whl
## Validate your installation
@@ -491,7 +489,7 @@ TensorFlow programs:
If the system outputs an error message instead of a greeting, see [Common
installation problems](#common_installation_problems).
-To learn more, see [Get Started with TensorFlow](https://www.tensorflow.org/get_started).
+To learn more, see the [TensorFlow tutorials](../tutorials/).
## TensorFlow GPU support
@@ -678,14 +676,14 @@ This section documents the relevant values for Linux installations.
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp27-none-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp27-none-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp27-none-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc0-cp27-none-linux_x86_64.whl
Note that GPU support requires the NVIDIA hardware and software described in
@@ -697,14 +695,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp34-cp34m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp34-cp34m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp34-cp34m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc0-cp34-cp34m-linux_x86_64.whl
Note that GPU support requires the NVIDIA hardware and software described in
@@ -716,14 +714,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp35-cp35m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp35-cp35m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp35-cp35m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc0-cp35-cp35m-linux_x86_64.whl
@@ -735,14 +733,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp36-cp36m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp36-cp36m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp36-cp36m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc0-cp36-cp36m-linux_x86_64.whl
diff --git a/tensorflow/docs_src/install/install_mac.md b/tensorflow/docs_src/install/install_mac.md
index 3de6da1342..c6f0c17924 100644
--- a/tensorflow/docs_src/install/install_mac.md
+++ b/tensorflow/docs_src/install/install_mac.md
@@ -119,7 +119,7 @@ Take the following steps to install TensorFlow with Virtualenv:
TensorFlow in the active Virtualenv is as follows:
$ pip3 install --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py3-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py3-none-any.whl
If you encounter installation problems, see
[Common Installation Problems](#common-installation-problems).
@@ -242,7 +242,7 @@ take the following steps:
issue the following command:
$ sudo pip3 install --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py3-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py3-none-any.whl
If the preceding command fails, see
[installation problems](#common-installation-problems).
@@ -350,7 +350,7 @@ Take the following steps to install TensorFlow in an Anaconda environment:
TensorFlow for Python 2.7:
(targetDirectory)$ pip install --ignore-installed --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py2-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py2-none-any.whl
@@ -403,8 +403,7 @@ writing TensorFlow programs:
If the system outputs an error message instead of a greeting, see
[Common installation problems](#common_installation_problems).
-To learn more, see [Get Started with TensorFlow](https://www.tensorflow.org/get_started).
-
+To learn more, see the [TensorFlow tutorials](../tutorials/).
## Common installation problems
@@ -518,7 +517,7 @@ The value you specify depends on your Python version.
-https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py2-none-any.whl
+https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py2-none-any.whl
@@ -526,5 +525,5 @@ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py2-none-a
-https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py3-none-any.whl
+https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py3-none-any.whl
diff --git a/tensorflow/docs_src/install/install_raspbian.md b/tensorflow/docs_src/install/install_raspbian.md
index 0caab6d335..46c4944ca7 100644
--- a/tensorflow/docs_src/install/install_raspbian.md
+++ b/tensorflow/docs_src/install/install_raspbian.md
@@ -230,7 +230,7 @@ problems, despite the log message.
If the system outputs an error message instead of a greeting, see [Common
installation problems](#common_installation_problems).
-To learn more, see [Get Started with TensorFlow](https://www.tensorflow.org/get_started).
+To learn more, see the [TensorFlow tutorials](../tutorials/).
## Common installation problems
diff --git a/tensorflow/docs_src/install/install_sources.md b/tensorflow/docs_src/install/install_sources.md
index 3520f97c9a..fc1f6d05bd 100644
--- a/tensorflow/docs_src/install/install_sources.md
+++ b/tensorflow/docs_src/install/install_sources.md
@@ -81,7 +81,7 @@ or
[macOS](#PrepareMac)
-
+
## Prepare environment for Linux
Before building TensorFlow on Linux, install the following build
@@ -289,17 +289,27 @@ Note: If you're only interested in building the libraries for the TensorFlow C
or Java APIs, see [Build the C or Java libraries](#BuildCorJava), you do not
need to build the pip package in that case.
-To build a pip package for TensorFlow with CPU-only support,
-you would typically invoke the following command:
+### CPU-only support
+
+To build a pip package for TensorFlow with CPU-only support:
+
+
+$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
+
+
+To build a pip package for TensorFlow with CPU-only support for the Intel® MKL-DNN:
-$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
+$ bazel build --config=mkl --config=opt //tensorflow/tools/pip_package:build_pip_package
-To build a pip package for TensorFlow with GPU support,
-invoke the following command:
+### GPU support
+
+To build a pip package for TensorFlow with GPU support:
-$ bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
+
+$ bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
+
**NOTE on gcc 5 or later:** the binary pip packages available on the
TensorFlow website are built with gcc 4, which uses the older ABI. To
@@ -328,10 +338,10 @@ Invoke `pip install` to install that pip package.
The filename of the `.whl` file depends on your platform.
For example, the following command will install the pip package
-for TensorFlow 1.9.0rc2 on Linux:
+for TensorFlow 1.9.0rc0 on Linux:
-$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.9.0rc2-py2-none-any.whl
+$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.9.0rc0-py2-none-any.whl
## Validate your installation
@@ -362,7 +372,7 @@ TensorFlow programs:
Hello, TensorFlow!
-To learn more, see [Get Started with TensorFlow](https://www.tensorflow.org/get_started).
+To learn more, see the [TensorFlow tutorials](../tutorials/).
If the system outputs an error message instead of a greeting, see [Common
installation problems](#common_installation_problems).
@@ -373,9 +383,9 @@ The build and installation problems you encounter typically depend on the
operating system. See the "Common installation problems" section
of one of the following guides:
- * @{$install_linux#CommonInstallationProblems$Installing TensorFlow on Linux}
- * @{$install_mac#CommonInstallationProblems$Installing TensorFlow on Mac OS}
- * @{$install_windows#CommonInstallationProblems$Installing TensorFlow on Windows}
+ * @{$install_linux#common_installation_problems$Installing TensorFlow on Linux}
+ * @{$install_mac#common_installation_problems$Installing TensorFlow on Mac OS}
+ * @{$install_windows#common_installation_problems$Installing TensorFlow on Windows}
Beyond the errors documented in those two guides, the following table
notes additional errors specific to building TensorFlow. Note that we
diff --git a/tensorflow/docs_src/install/install_windows.md b/tensorflow/docs_src/install/install_windows.md
index 7fe94f0bc3..7b7b17ce81 100644
--- a/tensorflow/docs_src/install/install_windows.md
+++ b/tensorflow/docs_src/install/install_windows.md
@@ -157,7 +157,7 @@ TensorFlow programs:
If the system outputs an error message instead of a greeting, see [Common
installation problems](#common_installation_problems).
-To learn more, see [Get Started with TensorFlow](https://www.tensorflow.org/get_started).
+To learn more, see the [TensorFlow tutorials](../tutorials/).
## Common installation problems
diff --git a/tensorflow/docs_src/mobile/leftnav_files b/tensorflow/docs_src/mobile/leftnav_files
index 585470d5f0..97340ef7e1 100644
--- a/tensorflow/docs_src/mobile/leftnav_files
+++ b/tensorflow/docs_src/mobile/leftnav_files
@@ -4,6 +4,7 @@ tflite/index.md
tflite/devguide.md
tflite/demo_android.md
tflite/demo_ios.md
+tflite/performance.md
>>>
### TensorFlow Mobile
mobile_intro.md
diff --git a/tensorflow/docs_src/mobile/linking_libs.md b/tensorflow/docs_src/mobile/linking_libs.md
index cf0db59021..efef5dd0da 100644
--- a/tensorflow/docs_src/mobile/linking_libs.md
+++ b/tensorflow/docs_src/mobile/linking_libs.md
@@ -27,7 +27,7 @@ called `libandroid_tensorflow_inference_java.jar`. There are three ways to
include this functionality in your program:
1. Include the jcenter AAR which contains it, as in this
- [example app](https://github.com/googlecodelabs/tensorflow-for-poets-2/blob/master/android/build.gradle#L59-L65)
+ [example app](https://github.com/googlecodelabs/tensorflow-for-poets-2/blob/master/android/tfmobile/build.gradle#L59-L65)
2. Download the nightly precompiled version from
[ci.tensorflow.org](http://ci.tensorflow.org/view/Nightly/job/nightly-android/lastSuccessfulBuild/artifact/out/).
diff --git a/tensorflow/docs_src/mobile/mobile_intro.md b/tensorflow/docs_src/mobile/mobile_intro.md
index 241f01d460..baad443308 100644
--- a/tensorflow/docs_src/mobile/mobile_intro.md
+++ b/tensorflow/docs_src/mobile/mobile_intro.md
@@ -38,7 +38,8 @@ speech-driven interface, and many of these require on-device processing. Most of
the time a user isn’t giving commands, and so streaming audio continuously to a
remote server would be a waste of bandwidth, since it would mostly be silence or
background noises. To solve this problem it’s common to have a small neural
-network running on-device @{$tutorials/audio_recognition$listening out for a particular keyword}.
+network running on-device
+[listening out for a particular keyword](../tutorials/sequences/audio_recognition).
Once that keyword has been spotted, the rest of the
conversation can be transmitted over to the server for further processing if
more computing power is needed.
diff --git a/tensorflow/docs_src/mobile/prepare_models.md b/tensorflow/docs_src/mobile/prepare_models.md
index 8b22c04d87..2b84dbb973 100644
--- a/tensorflow/docs_src/mobile/prepare_models.md
+++ b/tensorflow/docs_src/mobile/prepare_models.md
@@ -105,8 +105,8 @@ inline constants so everything’s in one file. To handle the conversion, you
need the `freeze_graph.py` script, that’s held in
[`tensorflow/python/tools/freeze_graph.py`](https://www.tensorflow.org/code/tensorflow/python/tools/freeze_graph.py). You’ll run it like this:
- bazel build tensorflow/tools:freeze_graph
- bazel-bin/tensorflow/tools/freeze_graph \
+ bazel build tensorflow/python/tools:freeze_graph
+ bazel-bin/tensorflow/python/tools/freeze_graph \
--input_graph=/tmp/model/my_graph.pb \
--input_checkpoint=/tmp/model/model.ckpt-1000 \
--output_graph=/tmp/frozen_graph.pb \
diff --git a/tensorflow/docs_src/mobile/tflite/demo_android.md b/tensorflow/docs_src/mobile/tflite/demo_android.md
index 7f2f8882a2..fdf0bcf3c1 100644
--- a/tensorflow/docs_src/mobile/tflite/demo_android.md
+++ b/tensorflow/docs_src/mobile/tflite/demo_android.md
@@ -1,7 +1,7 @@
# Android Demo App
An example Android application using TensorFLow Lite is available
-[on GitHub](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/java/demo/app).
+[on GitHub](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/java/demo).
The demo is a sample camera app that classifies images continuously
using either a quantized Mobilenet model or a floating point Inception-v3 model.
To run the demo, a device running Android 5.0 ( API 21) or higher is required.
@@ -44,20 +44,22 @@ app:
Android Studio project.
* Install all the Gradle extensions it requests.
-To get a model, either:
+Now you can build and run the demo app.
-* Download the quantized [Mobilenet TensorFlow Lite model](https://storage.googleapis.com/download.tensorflow.org/models/tflite/mobilenet_v1_224_android_quant_2017_11_08.zip)
- and unzip and copy `mobilenet_quant_v1_224.tflite` to the assets directory:
- `tensorflow/contrib/lite/java/demo/app/src/main/assets/`.
-* Or, download the floating point [Inception-v3 model](https://storage.googleapis.com/download.tensorflow.org/models/tflite/inception_v3_slim_2016_android_2017_11_10.zip)
- and unzip and copy `inceptionv3_non_slim_2015.tflite` to the assets
- directory. Change the chosen classifier in
- [Camera2BasicFragment.java](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/java/demo/app/src/main/java/com/example/android/tflitecamerademo/Camera2BasicFragment.java)
+The build process downloads the quantized [Mobilenet TensorFlow Lite model](https://storage.googleapis.com/download.tensorflow.org/models/tflite/mobilenet_v1_224_android_quant_2017_11_08.zip), and unzips it into the assets directory: `tensorflow/contrib/lite/java/demo/app/src/main/assets/`.
+
+Some additional details are available on the
+[TF Lite Android App page](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/java/demo/README.md).
+
+### Using other models
+
+To use a different model:
+* Download the floating point [Inception-v3 model](https://storage.googleapis.com/download.tensorflow.org/models/tflite/inception_v3_slim_2016_android_2017_11_10.zip).
+* Unzip and copy `inceptionv3_non_slim_2015.tflite` to the assets directory.
+* Change the chosen classifier in [Camera2BasicFragment.java](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/java/demo/app/src/main/java/com/example/android/tflitecamerademo/Camera2BasicFragment.java)
from: `classifier = new ImageClassifierQuantizedMobileNet(getActivity());`
to: `classifier = new ImageClassifierFloatInception(getActivity());`.
-Now you can build and run the demo app.
-
## Build TensorFlow Lite and the demo app from source
diff --git a/tensorflow/docs_src/mobile/tflite/devguide.md b/tensorflow/docs_src/mobile/tflite/devguide.md
index 4133bc172a..b168d6c183 100644
--- a/tensorflow/docs_src/mobile/tflite/devguide.md
+++ b/tensorflow/docs_src/mobile/tflite/devguide.md
@@ -54,10 +54,11 @@ both floating point and quantized inference.
### Train a custom model
A developer may choose to train a custom model using Tensorflow (see the
-@{$tutorials} for examples of building and training models). If you have already
-written a model, the first step is to export this to a @{tf.GraphDef} file. This
-is required because some formats do not store the model structure outside the
-code, and we must communicate with other parts of the framework. See
+[TensorFlow tutorials](../../tutorials/) for examples of building and training
+models). If you have already written a model, the first step is to export this
+to a @{tf.GraphDef} file. This is required because some formats do not store the
+model structure outside the code, and we must communicate with other parts of the
+framework. See
[Exporting the Inference Graph](https://github.com/tensorflow/models/blob/master/research/slim/README.md)
to create .pb file for the custom model.
diff --git a/tensorflow/docs_src/mobile/tflite/index.md b/tensorflow/docs_src/mobile/tflite/index.md
index 5622034827..3d1733024e 100644
--- a/tensorflow/docs_src/mobile/tflite/index.md
+++ b/tensorflow/docs_src/mobile/tflite/index.md
@@ -37,8 +37,9 @@ a custom (less-dynamic) memory allocator to ensure minimal load, initialization,
and execution latency.
TensorFlow Lite provides an interface to leverage hardware acceleration, if
-available on the device. It does so via the Android Neural Networks library,
-released as part of Android O-MR1.
+available on the device. It does so via the
+[Android Neural Networks API](https://developer.android.com/ndk/guides/neuralnetworks/index.html),
+available on Android 8.1 (API level 27) and higher.
## Why do we need a new mobile-specific library?
@@ -116,6 +117,10 @@ following:
Wear](https://research.googleblog.com/2017/02/on-device-machine-intelligence.html)
to all first-party and third-party apps.
+ Also see the complete list of
+ [TensorFlow Lite's supported models](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/g3doc/models.md),
+ including the model sizes, performance numbers, and downloadable model files.
+
- Quantized versions of the MobileNet model, which runs faster than the
non-quantized (float) version on CPU.
@@ -131,10 +136,10 @@ compatibility with this release.
## Getting Started
We recommend you try out TensorFlow Lite with the pre-tested models indicated
-above. If you have an existing mode, you will need to test whether your model is
-compatible with both the converter and the supported operator set. To test your
-model, see the [documentation on
-GitHub](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite).
+above. If you have an existing model, you will need to test whether your model
+is compatible with both the converter and the supported operator set. To test
+your model, see the
+[documentation on GitHub](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite).
### Retrain Inception-V3 or MobileNet for a custom data set
diff --git a/tensorflow/docs_src/mobile/tflite/performance.md b/tensorflow/docs_src/mobile/tflite/performance.md
new file mode 100644
index 0000000000..79bacaaa1b
--- /dev/null
+++ b/tensorflow/docs_src/mobile/tflite/performance.md
@@ -0,0 +1,174 @@
+# Performance
+
+This document lists TensorFlow Lite performance benchmarks when running well
+known models on some Android and iOS devices.
+
+These performance benchmark numbers were generated with the
+[Android TFLite benchmark binary](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/tools/benchmark)
+and the [iOS benchmark app](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/tools/benchmark/ios).
+
+# Android performance benchmarks
+
+For Android benchmarks, the CPU affinity is set to use big cores on the device to
+reduce variance (see [details](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/tools/benchmark#reducing-variance-between-runs-on-android)).
+
+It assumes that models were download and unzipped to the
+`/data/local/tmp/tflite_models` directory. The benchmark binary is built
+using [these instructions](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/tools/benchmark#on-android)
+and assumed in the `/data/local/tmp` directory.
+
+To run the benchmark:
+
+```
+adb shell taskset ${CPU_MASK} /data/local/tmp/benchmark_model \
+ --num_threads=1 \
+ --graph=/data/local/tmp/tflite_models/${GRAPH} \
+ --warmup_runs=1 \
+ --num_runs=50 \
+ --use_nnapi=false
+```
+
+Here, `${GRAPH}` is the name of model and `${CPU_MASK}` is the CPU affinity
+chosen according to the following table:
+
+Device | CPU_MASK |
+-------| ----------
+Pixel 2 | f0 |
+Pixel xl | 0c |
+
+
+
+
+
+ | Model Name |
+ Device |
+ Mean inference time (std dev) |
+
+
+
+ |
+ Mobilenet_1.0_224(float)
+ |
+ Pixel 2 |
+ 166.5 ms (2.6 ms) |
+
+
+ | Pixel xl |
+ 122.9 ms (1.8 ms) |
+
+
+ |
+ Mobilenet_1.0_224 (quant)
+ |
+ Pixel 2 |
+ 69.5 ms (0.9 ms) |
+
+
+ | Pixel xl |
+ 78.9 ms (2.2 ms) |
+
+
+ |
+ NASNet mobile
+ |
+ Pixel 2 |
+ 273.8 ms (3.5 ms) |
+
+
+ | Pixel xl |
+ 210.8 ms (4.2 ms) |
+
+
+ |
+ SqueezeNet
+ |
+ Pixel 2 |
+ 234.0 ms (2.1 ms) |
+
+
+ | Pixel xl |
+ 158.0 ms (2.1 ms) |
+
+
+ |
+ Inception_ResNet_V2
+ |
+ Pixel 2 |
+ 2846.0 ms (15.0 ms) |
+
+
+ | Pixel xl |
+ 1973.0 ms (15.0 ms) |
+
+
+ |
+ Inception_V4
+ |
+ Pixel 2 |
+ 3180.0 ms (11.7 ms) |
+
+
+ | Pixel xl |
+ 2262.0 ms (21.0 ms) |
+
+
+
+
+# iOS benchmarks
+
+To run iOS benchmarks, the [benchmark
+app](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/tools/benchmark/ios)
+was modified to include the appropriate model and `benchmark_params.json` was
+modified to set `num_threads` to 1.
+
+
diff --git a/tensorflow/docs_src/performance/quantization.md b/tensorflow/docs_src/performance/quantization.md
index 2fea02d861..c97f74139c 100644
--- a/tensorflow/docs_src/performance/quantization.md
+++ b/tensorflow/docs_src/performance/quantization.md
@@ -227,8 +227,8 @@ of 30.0f, and an 8-bit array, the quantized values represent the following:
| Quantized | Float |
| 0 | -10.0 |
- | 255 | 30.0 |
| 128 | 10.0 |
+ | 255 | 30.0 |
Table 2: Example quantized value range
diff --git a/tensorflow/docs_src/performance/xla/operation_semantics.md b/tensorflow/docs_src/performance/xla/operation_semantics.md
index 5887c3d88b..4c4f3f3934 100644
--- a/tensorflow/docs_src/performance/xla/operation_semantics.md
+++ b/tensorflow/docs_src/performance/xla/operation_semantics.md
@@ -581,12 +581,21 @@ Computes a sum across replicas.
Arguments | Type | Semantics
--------- | ------- | -----------------------------
`operand` | `XlaOp` | Array to sum across replicas.
+| `replica_group_ids` | `int64` vector | Group ID for each replica. |
The output shape is the same as the input shape. For example, if there are two
replicas and the operand has the value `(1.0, 2.5)` and `(3.0, 5.25)`
respectively on the two replicas, then the output value from this op will be
`(4.0, 7.75)` on both replicas.
+`replica_group_ids` identifies the group ID of each replica. The group ID must
+either be empty (all replicas belong to a single group), or contain the same
+number of elements as the number of replicas. For example, if
+`replica_group_ids` = {0, 1, 2, 3, 0, 1, 2, 3} has eight replicas, there are
+four subgroups of replica IDs: {0, 4}, {1, 5}, {2, 6}, and {3, 7}. The size of
+each subgroup *must* be identical, so, for example, using:
+`replica_group_ids` = {0, 1, 2, 0} for four replicas is invalid.
+
Computing the result of CrossReplicaSum requires having one input from each
replica, so if one replica executes a CrossReplicaSum node more times than
another, then the former replica will wait forever. Since the replicas are all
@@ -1299,12 +1308,10 @@ See also
: : : parameters of type T and M of :
: : : arbitrary type :
| `dimensions` | `int64` array | array of map dimensions |
-| `static_operands` | sequence of M `XlaOp`s | M arrays of arbitrary type |
Applies a scalar function over the given `operands` arrays, producing an array
of the same dimensions where each element is the result of the mapped function
-applied to the corresponding elements in the input arrays with `static_operands`
-given as additional input to `computation`.
+applied to the corresponding elements in the input arrays.
The mapped function is an arbitrary computation with the restriction that it has
N inputs of scalar type `T` and a single output with type `S`. The output has
@@ -2003,13 +2010,35 @@ Slice(b, {2, 1}, {4, 3}) produces:
See also
[`XlaBuilder::Sort`](https://www.tensorflow.org/code/tensorflow/compiler/xla/client/xla_client/xla_builder.h).
-Sorts the elements in the operand.
+There are two versions of the Sort instruction: a single-operand and a
+two-operand version.
`Sort(operand)`
+Arguments | Type | Semantics
+--------- | ------- | --------------------
+`operand` | `XlaOp` | The operand to sort.
+
+Sorts the elements in the operand in ascending order. The operand must be rank-1.
+If the operand's elements have floating point type, and the operand contains
+NaN elements, the order of elements in the output is implementation-defined.
+
+`Sort(key, value)`
+
+Sorts both the key and the value operands. The keys are sorted as in the
+single-operand version. The values are sorted according to the order of their
+corresponding keys. For example, if the inputs are `keys = [3, 1]` and
+`values = [42, 50]`, then the output of the sort is the tuple `{[1, 3], [50, 42]}`.
+The sort is not guaranteed to be stable, that is, if the keys array contains
+duplicates, the order of their corresponding values may not be preserved.
+
Arguments | Type | Semantics
--------- | ------- | -------------------
-`operand` | `XlaOp` | The operand to sort
+`keys` | `XlaOp` | The sort keys.
+`values` | `XlaOp` | The values to sort.
+
+The `keys` and `values` operand must both be rank-1, and must have the same
+dimensions, but may have different element types.
## Transpose
diff --git a/tensorflow/docs_src/get_started/_index.yaml b/tensorflow/docs_src/tutorials/_index.yaml
similarity index 77%
rename from tensorflow/docs_src/get_started/_index.yaml
rename to tensorflow/docs_src/tutorials/_index.yaml
index 4060804892..6fc8155669 100644
--- a/tensorflow/docs_src/get_started/_index.yaml
+++ b/tensorflow/docs_src/tutorials/_index.yaml
@@ -75,11 +75,11 @@ landing_page:
TensorFlow Keras guide.
- - Basic classification
- - Text classification
- - Regression
- - Overfitting and underfitting
- - Save and load
+ - Basic classification
+ - Text classification
+ - Regression
+ - Overfitting and underfitting
+ - Save and load
@@ -109,7 +109,7 @@ landing_page:
model.evaluate(x_test, y_test)
{% dynamic if request.tld != 'cn' %}
-
Run in a Notebook
+
Run in a Notebook
{% dynamic endif %}
- items:
@@ -124,38 +124,38 @@ landing_page:
-
{% dynamic if request.tld == 'cn' %}
- Eager execution basics
+ Eager execution basics
{% dynamic else %}
- Eager execution basics
+ Eager execution basics
{% dynamic endif %}
-
{% dynamic if request.tld == 'cn' %}
- Automatic differentiation and gradient tapes
+ Automatic differentiation and gradient tape
{% dynamic else %}
- Automatic differentiation and gradient tapes
+ Automatic differentiation and gradient tape
{% dynamic endif %}
-
{% dynamic if request.tld == 'cn' %}
- Variables, models, and training
+ Custom training: basics
{% dynamic else %}
- Variables, models, and training
+ Custom training: basics
{% dynamic endif %}
-
{% dynamic if request.tld == 'cn' %}
- Custom layers
+ Custom layers
{% dynamic else %}
- Custom layers
+ Custom layers
{% dynamic endif %}
- - Custom training walkthrough
+ - Custom training: walkthrough
-
{% dynamic if request.tld == 'cn' %}
Example: Neural machine translation w/ attention
{% dynamic else %}
- Example: Neural machine translation w/ attention
+ Example: Neural machine translation w/ attention
{% dynamic endif %}
@@ -170,13 +170,15 @@ landing_page:
@@ -187,7 +189,7 @@ landing_page:
- description: >
Google Colab: An easy way to learn and use TensorFlow
- Colaboratory
+ Colaboratory
is a Google research project created to help disseminate machine learning
education and research. It's a Jupyter notebook environment that requires
no setup to use and runs entirely in the cloud.
diff --git a/tensorflow/docs_src/tutorials/_toc.yaml b/tensorflow/docs_src/tutorials/_toc.yaml
new file mode 100644
index 0000000000..d46d570a93
--- /dev/null
+++ b/tensorflow/docs_src/tutorials/_toc.yaml
@@ -0,0 +1,93 @@
+toc:
+- title: Get started with TensorFlow
+ path: /tutorials/
+
+- title: Learn and use ML
+ style: accordion
+ section:
+ - title: Overview
+ path: /tutorials/keras/
+ - title: Basic classification
+ path: /tutorials/keras/basic_classification
+ - title: Text classification
+ path: /tutorials/keras/basic_text_classification
+ - title: Regression
+ path: /tutorials/keras/basic_regression
+ - title: Overfitting and underfitting
+ path: /tutorials/keras/overfit_and_underfit
+ - title: Save and restore models
+ path: /tutorials/keras/save_and_restore_models
+
+- title: Research and experimentation
+ style: accordion
+ section:
+ - title: Overview
+ path: /tutorials/eager/
+ - title: Eager execution
+ path: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/notebooks/eager_intro.ipynb
+ status: external
+ - title: Automatic differentiation
+ path: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/notebooks/automatic_differentiation.ipynb
+ status: external
+ - title: "Custom training: basics"
+ path: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/notebooks/custom_training.ipynb
+ status: external
+ - title: Custom layers
+ path: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/notebooks/custom_layers.ipynb
+ status: external
+ - title: "Custom training: walkthrough"
+ path: /tutorials/eager/custom_training_walkthrough
+ - title: Neural machine translation
+ path: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb
+ status: external
+
+- title: Images
+ style: accordion
+ section:
+ - title: Build a CNN using Estimators
+ path: /tutorials/images/layers
+ - title: Image recognition
+ path: /tutorials/images/image_recognition
+ - title: Image retraining
+ path: /hub/tutorials/image_retraining
+ - title: Advanced CNN
+ path: /tutorials/images/deep_cnn
+
+- title: Sequences
+ style: accordion
+ section:
+ - title: Recurrent neural network
+ path: /tutorials/sequences/recurrent
+ - title: Drawing classification
+ path: /tutorials/sequences/recurrent_quickdraw
+ - title: Simple audio recognition
+ path: /tutorials/sequences/audio_recognition
+ - title: Neural machine translation
+ path: https://github.com/tensorflow/nmt
+ status: external
+
+- title: Data representation
+ style: accordion
+ section:
+ - title: Linear models
+ path: /tutorials/representation/wide
+ - title: Wide and deep learning
+ path: /tutorials/representation/wide_and_deep
+ - title: Vector representations of words
+ path: /tutorials/representation/word2vec
+ - title: Kernel methods
+ path: /tutorials/representation/kernel_methods
+ - title: Large-scale linear models
+ path: /tutorials/representation/linear
+
+- title: Non-ML
+ style: accordion
+ section:
+ - title: Mandelbrot set
+ path: /tutorials/non-ml/mandelbrot
+ - title: Partial differential equations
+ path: /tutorials/non-ml/pdes
+
+- break: True
+- title: Next steps
+ path: /tutorials/next_steps
diff --git a/tensorflow/docs_src/tutorials/eager/custom_training_walkthrough.md b/tensorflow/docs_src/tutorials/eager/custom_training_walkthrough.md
new file mode 100644
index 0000000000..b45fbefac0
--- /dev/null
+++ b/tensorflow/docs_src/tutorials/eager/custom_training_walkthrough.md
@@ -0,0 +1,3 @@
+# Custom training: walkthrough
+
+[Colab notebook](https://colab.research.google.com/github/tensorflow/models/blob/master/samples/core/get_started/eager.ipynb)
diff --git a/tensorflow/docs_src/tutorials/eager/index.md b/tensorflow/docs_src/tutorials/eager/index.md
new file mode 100644
index 0000000000..5445e0c343
--- /dev/null
+++ b/tensorflow/docs_src/tutorials/eager/index.md
@@ -0,0 +1,13 @@
+# Research and experimentation
+
+Eager execution provides an imperative, define-by-run interface for advanced
+operations. Write custom layers, forward passes, and training loops with
+auto differentiation. Start with these notebooks, then read the
+[eager execution guide](../../guide/eager).
+
+1. [Eager execution](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/notebooks/eager_intro.ipynb){:.external}
+2. [Automatic differentiation and gradient tape](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/notebooks/automatic_differentiation.ipynb){:.external}
+3. [Custom training: basics](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/notebooks/custom_training.ipynb){:.external}
+4. [Custom layers](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/notebooks/custom_layers.ipynb){:.external}
+5. [Custom training: walkthrough](/tutorials/eager/custom_training_walkthrough)
+6. [Advanced example: Neural machine translation with attention](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb){:.external}
diff --git a/tensorflow/docs_src/tutorials/image_retraining.md b/tensorflow/docs_src/tutorials/image_retraining.md
deleted file mode 100644
index 27784eef9c..0000000000
--- a/tensorflow/docs_src/tutorials/image_retraining.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# How to Retrain Inception's Final Layer for New Categories
-
-**NOTE: This tutorial has moved to**
-https://github.com/tensorflow/hub/tree/master/docs/tutorials/image_retraining.md
diff --git a/tensorflow/docs_src/tutorials/deep_cnn.md b/tensorflow/docs_src/tutorials/images/deep_cnn.md
similarity index 98%
rename from tensorflow/docs_src/tutorials/deep_cnn.md
rename to tensorflow/docs_src/tutorials/images/deep_cnn.md
index 44a32d9d1d..1590f15eb9 100644
--- a/tensorflow/docs_src/tutorials/deep_cnn.md
+++ b/tensorflow/docs_src/tutorials/images/deep_cnn.md
@@ -1,7 +1,4 @@
-# Convolutional Neural Networks
-
-> **NOTE:** This tutorial is intended for *advanced* users of TensorFlow
-and assumes expertise and experience in machine learning.
+# Advanced Convolutional Neural Networks
## Overview
@@ -438,9 +435,6 @@ with a batch size of 64 and compare the training speed.
## Next Steps
-[Congratulations!](https://www.youtube.com/watch?v=9bZkp7q19f0) You have
-completed the CIFAR-10 tutorial.
-
If you are now interested in developing and training your own image
classification system, we recommend forking this tutorial and replacing
components to address your image classification problem.
diff --git a/tensorflow/docs_src/tutorials/image_recognition.md b/tensorflow/docs_src/tutorials/images/image_recognition.md
similarity index 99%
rename from tensorflow/docs_src/tutorials/image_recognition.md
rename to tensorflow/docs_src/tutorials/images/image_recognition.md
index 332bcf54f0..432d470d0c 100644
--- a/tensorflow/docs_src/tutorials/image_recognition.md
+++ b/tensorflow/docs_src/tutorials/images/image_recognition.md
@@ -434,7 +434,6 @@ should be able to transfer some of that understanding to solving related
problems. One way to perform transfer learning is to remove the final
classification layer of the network and extract
the [next-to-last layer of the CNN](https://arxiv.org/abs/1310.1531), in this case a 2048 dimensional vector.
-There's a guide to doing this @{$image_retraining$in the how-to section}.
## Resources for Learning More
diff --git a/tensorflow/docs_src/tutorials/layers.md b/tensorflow/docs_src/tutorials/images/layers.md
similarity index 94%
rename from tensorflow/docs_src/tutorials/layers.md
rename to tensorflow/docs_src/tutorials/images/layers.md
index 212e337637..12a215b50c 100644
--- a/tensorflow/docs_src/tutorials/layers.md
+++ b/tensorflow/docs_src/tutorials/images/layers.md
@@ -1,4 +1,4 @@
-# A Guide to TF Layers: Building a Convolutional Neural Network
+# Build a Convolutional Neural Network using Estimators
The TensorFlow @{tf.layers$`layers` module} provides a high-level API that makes
it easy to construct a neural network. It provides methods that facilitate the
@@ -470,51 +470,18 @@ as the loss metric. The following code calculates cross entropy when the model
runs in either `TRAIN` or `EVAL` mode:
```python
-onehot_labels = tf.one_hot(indices=tf.cast(labels, tf.int32), depth=10)
-loss = tf.losses.softmax_cross_entropy(
- onehot_labels=onehot_labels, logits=logits)
+loss = tf.losses.sparse_softmax_cross_entropy(labels=labels, logits=logits)
```
Let's take a closer look at what's happening above.
-Our `labels` tensor contains a list of predictions for our examples, e.g. `[1,
-9, ...]`. In order to calculate cross-entropy, first we need to convert `labels`
-to the corresponding
-[one-hot encoding](https://www.quora.com/What-is-one-hot-encoding-and-when-is-it-used-in-data-science):
+Our `labels` tensor contains a list of prediction indices for our examples, e.g. `[1,
+9, ...]`. `logits` contains the linear outputs of our last layer.
-```none
-[[0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
- ...]
-```
-
-We use the @{tf.one_hot} function
-to perform this conversion. `tf.one_hot()` has two required arguments:
-
-* `indices`. The locations in the one-hot tensor that will have "on
- values"—i.e., the locations of `1` values in the tensor shown above.
-* `depth`. The depth of the one-hot tensor—i.e., the number of target classes.
- Here, the depth is `10`.
+`tf.losses.sparse_softmax_cross_entropy`, calculates the softmax crossentropy
+(aka: categorical crossentropy, negative log-likelihood) from these two inputs
+in an efficient, numerically stable way.
-The following code creates the one-hot tensor for our labels, `onehot_labels`:
-
-```python
-onehot_labels = tf.one_hot(indices=tf.cast(labels, tf.int32), depth=10)
-```
-
-Because `labels` contains a series of values from 0–9, `indices` is just our
-`labels` tensor, with values cast to integers. The `depth` is `10` because we
-have 10 possible target classes, one for each digit.
-
-Next, we compute cross-entropy of `onehot_labels` and the softmax of the
-predictions from our logits layer. `tf.losses.softmax_cross_entropy()` takes
-`onehot_labels` and `logits` as arguments, performs softmax activation on
-`logits`, calculates cross-entropy, and returns our `loss` as a scalar `Tensor`:
-
-```python
-loss = tf.losses.softmax_cross_entropy(
- onehot_labels=onehot_labels, logits=logits)
-```
### Configure the Training Op
diff --git a/tensorflow/docs_src/tutorials/index.md b/tensorflow/docs_src/tutorials/index.md
deleted file mode 100644
index 6bd3a3a897..0000000000
--- a/tensorflow/docs_src/tutorials/index.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# Tutorials
-
-
-This section contains tutorials demonstrating how to do specific tasks
-in TensorFlow. If you are new to TensorFlow, we recommend reading
-[Get Started with TensorFlow](/get_started/).
-
-## Images
-
-These tutorials cover different aspects of image recognition:
-
- * @{$layers$MNIST}, which introduces convolutional neural networks (CNNs) and
- demonstrates how to build a CNN in TensorFlow.
- * @{$image_recognition}, which introduces the field of image recognition and
- uses a pre-trained model (Inception) for recognizing images.
- * @{$image_retraining}, which has a wonderfully self-explanatory title.
- * @{$deep_cnn}, which demonstrates how to build a small CNN for recognizing
- images. This tutorial is aimed at advanced TensorFlow users.
-
-
-## Sequences
-
-These tutorials focus on machine learning problems dealing with sequence data.
-
- * @{$recurrent}, which demonstrates how to use a
- recurrent neural network to predict the next word in a sentence.
- * @{$seq2seq}, which demonstrates how to use a
- sequence-to-sequence model to translate text from English to French.
- * @{$recurrent_quickdraw}
- builds a classification model for drawings, directly from the sequence of
- pen strokes.
- * @{$audio_recognition}, which shows how to
- build a basic speech recognition network.
-
-## Data representation
-
-These tutorials demonstrate various data representations that can be used in
-TensorFlow.
-
- * @{$wide}, uses
- @{tf.feature_column$feature columns} to feed a variety of data types
- to linear model, to solve a classification problem.
- * @{$wide_and_deep}, builds on the
- above linear model tutorial, adding a deep feed-forward neural network
- component and a DNN-compatible data representation.
- * @{$word2vec}, which demonstrates how to
- create an embedding for words.
- * @{$kernel_methods},
- which shows how to improve the quality of a linear model by using explicit
- kernel mappings.
-
-## Non Machine Learning
-
-Although TensorFlow specializes in machine learning, the core of TensorFlow is
-a powerful numeric computation system which you can also use to solve other
-kinds of math problems. For example:
-
- * @{$mandelbrot}
- * @{$pdes}
diff --git a/tensorflow/docs_src/get_started/basic_classification.md b/tensorflow/docs_src/tutorials/keras/basic_classification.md
similarity index 100%
rename from tensorflow/docs_src/get_started/basic_classification.md
rename to tensorflow/docs_src/tutorials/keras/basic_classification.md
diff --git a/tensorflow/docs_src/get_started/basic_regression.md b/tensorflow/docs_src/tutorials/keras/basic_regression.md
similarity index 100%
rename from tensorflow/docs_src/get_started/basic_regression.md
rename to tensorflow/docs_src/tutorials/keras/basic_regression.md
diff --git a/tensorflow/docs_src/get_started/basic_text_classification.md b/tensorflow/docs_src/tutorials/keras/basic_text_classification.md
similarity index 100%
rename from tensorflow/docs_src/get_started/basic_text_classification.md
rename to tensorflow/docs_src/tutorials/keras/basic_text_classification.md
diff --git a/tensorflow/docs_src/tutorials/keras/index.md b/tensorflow/docs_src/tutorials/keras/index.md
new file mode 100644
index 0000000000..9d42281c8f
--- /dev/null
+++ b/tensorflow/docs_src/tutorials/keras/index.md
@@ -0,0 +1,22 @@
+# Learn and use machine learning
+
+This notebook collection is inspired by the book
+*[Deep Learning with Python](https://books.google.com/books?id=Yo3CAQAACAAJ)*.
+These tutorials use `tf.keras`, TensorFlow's high-level Python API for building
+and training deep learning models. To learn more about using Keras with
+TensorFlow, see the [TensorFlow Keras Guide](../../guide/keras).
+
+Publisher's note: *Deep Learning with Python* introduces the field of deep
+learning using the Python language and the powerful Keras library. Written by
+Keras creator and Google AI researcher François Chollet, this book builds your
+understanding through intuitive explanations and practical examples.
+
+To learn about machine learning fundamentals and concepts, consider taking the
+[Machine Learning Crash Course](https://developers.google.com/machine-learning/crash-course/).
+Additional TensorFlow and machine learning resources are listed in [next steps](../next_steps).
+
+1. [Basic classification](./basic_classification)
+2. [Text classification](./basic_text_classification)
+3. [Regression](./basic_regression)
+4. [Overfitting and underfitting](./overfit_and_underfit)
+5. [Save and restore models](./save_and_restore_models)
diff --git a/tensorflow/docs_src/get_started/overfit_and_underfit.md b/tensorflow/docs_src/tutorials/keras/overfit_and_underfit.md
similarity index 100%
rename from tensorflow/docs_src/get_started/overfit_and_underfit.md
rename to tensorflow/docs_src/tutorials/keras/overfit_and_underfit.md
diff --git a/tensorflow/docs_src/get_started/save_and_restore_models.md b/tensorflow/docs_src/tutorials/keras/save_and_restore_models.md
similarity index 100%
rename from tensorflow/docs_src/get_started/save_and_restore_models.md
rename to tensorflow/docs_src/tutorials/keras/save_and_restore_models.md
diff --git a/tensorflow/docs_src/tutorials/leftnav_files b/tensorflow/docs_src/tutorials/leftnav_files
deleted file mode 100644
index 888052428f..0000000000
--- a/tensorflow/docs_src/tutorials/leftnav_files
+++ /dev/null
@@ -1,23 +0,0 @@
-index.md
-
-### Images
-layers.md: MNIST
-image_recognition.md: Image Recognition
-image_retraining.md: Image Retraining
-deep_cnn.md
-
-### Sequences
-recurrent.md
-seq2seq.md: Neural Machine Translation
-recurrent_quickdraw.md: Drawing Classification
-audio_recognition.md
-
-### Data Representation
-wide.md: Linear Models
-wide_and_deep.md: Wide & Deep Learning
-word2vec.md
-kernel_methods.md: Kernel Methods
-
-### Non-ML
-mandelbrot.md
-pdes.md
diff --git a/tensorflow/docs_src/get_started/next_steps.md b/tensorflow/docs_src/tutorials/next_steps.md
similarity index 100%
rename from tensorflow/docs_src/get_started/next_steps.md
rename to tensorflow/docs_src/tutorials/next_steps.md
diff --git a/tensorflow/docs_src/tutorials/mandelbrot.md b/tensorflow/docs_src/tutorials/non-ml/mandelbrot.md
old mode 100755
new mode 100644
similarity index 100%
rename from tensorflow/docs_src/tutorials/mandelbrot.md
rename to tensorflow/docs_src/tutorials/non-ml/mandelbrot.md
diff --git a/tensorflow/docs_src/tutorials/pdes.md b/tensorflow/docs_src/tutorials/non-ml/pdes.md
old mode 100755
new mode 100644
similarity index 98%
rename from tensorflow/docs_src/tutorials/pdes.md
rename to tensorflow/docs_src/tutorials/non-ml/pdes.md
index 425e8d7084..b5a0fa834a
--- a/tensorflow/docs_src/tutorials/pdes.md
+++ b/tensorflow/docs_src/tutorials/non-ml/pdes.md
@@ -135,7 +135,6 @@ for i in range(1000):
DisplayArray(U.eval(), rng=[-0.1, 0.1])
```
-
+
Look! Ripples!
-
diff --git a/tensorflow/docs_src/tutorials/kernel_methods.md b/tensorflow/docs_src/tutorials/representation/kernel_methods.md
similarity index 99%
rename from tensorflow/docs_src/tutorials/kernel_methods.md
rename to tensorflow/docs_src/tutorials/representation/kernel_methods.md
index 205e2a2d2c..f3c232c511 100644
--- a/tensorflow/docs_src/tutorials/kernel_methods.md
+++ b/tensorflow/docs_src/tutorials/representation/kernel_methods.md
@@ -27,7 +27,7 @@ TensorFlow will provide support for sparse features at a later release.
This tutorial uses [tf.contrib.learn](https://www.tensorflow.org/code/tensorflow/contrib/learn/python/learn)
(TensorFlow's high-level Machine Learning API) Estimators for our ML models.
-If you are not familiar with this API, [tf.estimator Quickstart](https://www.tensorflow.org/get_started/estimator)
+If you are not familiar with this API, The [Estimator guide](../../guide/estimators.md)
is a good place to start. We will use the MNIST dataset. The tutorial consists
of the following steps:
diff --git a/tensorflow/docs_src/tutorials/linear.md b/tensorflow/docs_src/tutorials/representation/linear.md
similarity index 100%
rename from tensorflow/docs_src/tutorials/linear.md
rename to tensorflow/docs_src/tutorials/representation/linear.md
diff --git a/tensorflow/docs_src/tutorials/wide.md b/tensorflow/docs_src/tutorials/representation/wide.md
similarity index 100%
rename from tensorflow/docs_src/tutorials/wide.md
rename to tensorflow/docs_src/tutorials/representation/wide.md
diff --git a/tensorflow/docs_src/tutorials/wide_and_deep.md b/tensorflow/docs_src/tutorials/representation/wide_and_deep.md
similarity index 100%
rename from tensorflow/docs_src/tutorials/wide_and_deep.md
rename to tensorflow/docs_src/tutorials/representation/wide_and_deep.md
diff --git a/tensorflow/docs_src/tutorials/word2vec.md b/tensorflow/docs_src/tutorials/representation/word2vec.md
similarity index 100%
rename from tensorflow/docs_src/tutorials/word2vec.md
rename to tensorflow/docs_src/tutorials/representation/word2vec.md
diff --git a/tensorflow/docs_src/tutorials/seq2seq.md b/tensorflow/docs_src/tutorials/seq2seq.md
deleted file mode 100644
index 8928ba4f7d..0000000000
--- a/tensorflow/docs_src/tutorials/seq2seq.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Sequence-to-Sequence Models
-
-Please check out the
-[tensorflow neural machine translation tutorial](https://github.com/tensorflow/nmt)
-for building sequence-to-sequence models with the latest Tensorflow API.
diff --git a/tensorflow/docs_src/tutorials/audio_recognition.md b/tensorflow/docs_src/tutorials/sequences/audio_recognition.md
similarity index 100%
rename from tensorflow/docs_src/tutorials/audio_recognition.md
rename to tensorflow/docs_src/tutorials/sequences/audio_recognition.md
diff --git a/tensorflow/docs_src/tutorials/recurrent.md b/tensorflow/docs_src/tutorials/sequences/recurrent.md
similarity index 98%
rename from tensorflow/docs_src/tutorials/recurrent.md
rename to tensorflow/docs_src/tutorials/sequences/recurrent.md
index 14da2c8785..715cc7856a 100644
--- a/tensorflow/docs_src/tutorials/recurrent.md
+++ b/tensorflow/docs_src/tutorials/sequences/recurrent.md
@@ -2,8 +2,8 @@
## Introduction
-Take a look at [this great article](https://colah.github.io/posts/2015-08-Understanding-LSTMs/)
-for an introduction to recurrent neural networks and LSTMs in particular.
+See [Understanding LSTM Networks](https://colah.github.io/posts/2015-08-Understanding-LSTMs/){:.external}
+for an introduction to recurrent neural networks and LSTMs.
## Language Modeling
diff --git a/tensorflow/docs_src/tutorials/recurrent_quickdraw.md b/tensorflow/docs_src/tutorials/sequences/recurrent_quickdraw.md
similarity index 98%
rename from tensorflow/docs_src/tutorials/recurrent_quickdraw.md
rename to tensorflow/docs_src/tutorials/sequences/recurrent_quickdraw.md
index 1afd861738..37bce5b76d 100644
--- a/tensorflow/docs_src/tutorials/recurrent_quickdraw.md
+++ b/tensorflow/docs_src/tutorials/sequences/recurrent_quickdraw.md
@@ -13,7 +13,7 @@ In this tutorial we'll show how to build an RNN-based recognizer for this
problem. The model will use a combination of convolutional layers, LSTM layers,
and a softmax output layer to classify the drawings:
-

+

The figure above shows the structure of the model that we will build in this
tutorial. The input is a drawing that is encoded as a sequence of strokes of
@@ -208,7 +208,7 @@ This data is then reformatted into a tensor of shape `[num_training_samples,
max_length, 3]`. Then we determine the bounding box of the original drawing in
screen coordinates and normalize the size such that the drawing has unit height.
-

+

Finally, we compute the differences between consecutive points and store these
as a `VarLenFeature` in a
--
GitLab
From b46fde9a42f97d66535a2dde60642ce22473f80c Mon Sep 17 00:00:00 2001
From: Billy Lamberta
Date: Tue, 3 Jul 2018 16:56:01 -0700
Subject: [PATCH 075/519] fix rc2
---
tensorflow/docs_src/install/install_c.md | 2 +-
tensorflow/docs_src/install/install_go.md | 2 +-
tensorflow/docs_src/install/install_java.md | 22 +++++++++----------
tensorflow/docs_src/install/install_linux.md | 18 +++++++--------
tensorflow/docs_src/install/install_mac.md | 10 ++++-----
.../docs_src/install/install_sources.md | 4 ++--
6 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/tensorflow/docs_src/install/install_c.md b/tensorflow/docs_src/install/install_c.md
index 2901848745..9aebf2bfa4 100644
--- a/tensorflow/docs_src/install/install_c.md
+++ b/tensorflow/docs_src/install/install_c.md
@@ -38,7 +38,7 @@ enable TensorFlow for C:
OS="linux" # Change to "darwin" for macOS
TARGET_DIRECTORY="/usr/local"
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-${OS}-x86_64-1.9.0-rc0.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-${OS}-x86_64-1.9.0-rc2.tar.gz" |
sudo tar -C $TARGET_DIRECTORY -xz
The `tar` command extracts the TensorFlow C library into the `lib`
diff --git a/tensorflow/docs_src/install/install_go.md b/tensorflow/docs_src/install/install_go.md
index 2c126df5aa..1907355341 100644
--- a/tensorflow/docs_src/install/install_go.md
+++ b/tensorflow/docs_src/install/install_go.md
@@ -38,7 +38,7 @@ steps to install this library and enable TensorFlow for Go:
TF_TYPE="cpu" # Change to "gpu" for GPU support
TARGET_DIRECTORY='/usr/local'
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-$(go env GOOS)-x86_64-1.9.0-rc0.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-$(go env GOOS)-x86_64-1.9.0-rc2.tar.gz" |
sudo tar -C $TARGET_DIRECTORY -xz
The `tar` command extracts the TensorFlow C library into the `lib`
diff --git a/tensorflow/docs_src/install/install_java.md b/tensorflow/docs_src/install/install_java.md
index 692dfc9cef..1fbdcc2b47 100644
--- a/tensorflow/docs_src/install/install_java.md
+++ b/tensorflow/docs_src/install/install_java.md
@@ -36,7 +36,7 @@ following to the project's `pom.xml` to use the TensorFlow Java APIs:
org.tensorflow
tensorflow
- 1.9.0-rc0
+ 1.9.0-rc2
```
@@ -65,7 +65,7 @@ As an example, these steps will create a Maven project that uses TensorFlow:
org.tensorflow
tensorflow
- 1.9.0-rc0
+ 1.9.0-rc2
@@ -124,12 +124,12 @@ instead:
org.tensorflow
libtensorflow
- 1.9.0-rc0
+ 1.9.0-rc2
org.tensorflow
libtensorflow_jni_gpu
- 1.9.0-rc0
+ 1.9.0-rc2
```
@@ -148,7 +148,7 @@ refer to the simpler instructions above instead.
Take the following steps to install TensorFlow for Java on Linux or macOS:
1. Download
- [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc0.jar),
+ [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc2.jar),
which is the TensorFlow Java Archive (JAR).
2. Decide whether you will run TensorFlow for Java on CPU(s) only or with
@@ -167,7 +167,7 @@ Take the following steps to install TensorFlow for Java on Linux or macOS:
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
mkdir -p ./jni
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-${TF_TYPE}-${OS}-x86_64-1.9.0-rc0.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-${TF_TYPE}-${OS}-x86_64-1.9.0-rc2.tar.gz" |
tar -xz -C ./jni
### Install on Windows
@@ -175,10 +175,10 @@ Take the following steps to install TensorFlow for Java on Linux or macOS:
Take the following steps to install TensorFlow for Java on Windows:
1. Download
- [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc0.jar),
+ [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc2.jar),
which is the TensorFlow Java Archive (JAR).
2. Download the following Java Native Interface (JNI) file appropriate for
- [TensorFlow for Java on Windows](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-cpu-windows-x86_64-1.9.0-rc0.zip).
+ [TensorFlow for Java on Windows](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-cpu-windows-x86_64-1.9.0-rc2.zip).
3. Extract this .zip file.
__Note__: The native library (`tensorflow_jni.dll`) requires `msvcp140.dll` at runtime, which is included in the [Visual C++ 2015 Redistributable](https://www.microsoft.com/en-us/download/details.aspx?id=48145) package.
@@ -227,7 +227,7 @@ must be part of your `classpath`. For example, you can include the
downloaded `.jar` in your `classpath` by using the `-cp` compilation flag
as follows:
-javac -cp libtensorflow-1.9.0-rc0.jar HelloTF.java
+javac -cp libtensorflow-1.9.0-rc2.jar HelloTF.java
### Running
@@ -241,11 +241,11 @@ two files are available to the JVM:
For example, the following command line executes the `HelloTF` program on Linux
and macOS X:
-java -cp libtensorflow-1.9.0-rc0.jar:. -Djava.library.path=./jni HelloTF
+java -cp libtensorflow-1.9.0-rc2.jar:. -Djava.library.path=./jni HelloTF
And the following command line executes the `HelloTF` program on Windows:
-java -cp libtensorflow-1.9.0-rc0.jar;. -Djava.library.path=jni HelloTF
+java -cp libtensorflow-1.9.0-rc2.jar;. -Djava.library.path=jni HelloTF
If the program prints Hello from version, you've successfully
installed TensorFlow for Java and are ready to use the API. If the program
diff --git a/tensorflow/docs_src/install/install_linux.md b/tensorflow/docs_src/install/install_linux.md
index f21c073a1b..8efa166073 100644
--- a/tensorflow/docs_src/install/install_linux.md
+++ b/tensorflow/docs_src/install/install_linux.md
@@ -436,7 +436,7 @@ Take the following steps to install TensorFlow in an Anaconda environment:
(tensorflow)$ pip install --ignore-installed --upgrade \
- https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp34-cp34m-linux_x86_64.whl
+ https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp34-cp34m-linux_x86_64.whl
## Validate your installation
@@ -676,14 +676,14 @@ This section documents the relevant values for Linux installations.
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp27-none-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp27-none-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc0-cp27-none-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp27-none-linux_x86_64.whl
Note that GPU support requires the NVIDIA hardware and software described in
@@ -695,14 +695,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp34-cp34m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp34-cp34m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc0-cp34-cp34m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp34-cp34m-linux_x86_64.whl
Note that GPU support requires the NVIDIA hardware and software described in
@@ -714,14 +714,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp35-cp35m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp35-cp35m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc0-cp35-cp35m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp35-cp35m-linux_x86_64.whl
@@ -733,14 +733,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc0-cp36-cp36m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp36-cp36m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc0-cp36-cp36m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp36-cp36m-linux_x86_64.whl
diff --git a/tensorflow/docs_src/install/install_mac.md b/tensorflow/docs_src/install/install_mac.md
index c6f0c17924..5b593d1ca9 100644
--- a/tensorflow/docs_src/install/install_mac.md
+++ b/tensorflow/docs_src/install/install_mac.md
@@ -119,7 +119,7 @@ Take the following steps to install TensorFlow with Virtualenv:
TensorFlow in the active Virtualenv is as follows:
$ pip3 install --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py3-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py3-none-any.whl
If you encounter installation problems, see
[Common Installation Problems](#common-installation-problems).
@@ -242,7 +242,7 @@ take the following steps:
issue the following command:
$ sudo pip3 install --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py3-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py3-none-any.whl
If the preceding command fails, see
[installation problems](#common-installation-problems).
@@ -350,7 +350,7 @@ Take the following steps to install TensorFlow in an Anaconda environment:
TensorFlow for Python 2.7:
(targetDirectory)$ pip install --ignore-installed --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py2-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py2-none-any.whl
@@ -517,7 +517,7 @@ The value you specify depends on your Python version.
-https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py2-none-any.whl
+https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py2-none-any.whl
@@ -525,5 +525,5 @@ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py2-none-a
-https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc0-py3-none-any.whl
+https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py3-none-any.whl
diff --git a/tensorflow/docs_src/install/install_sources.md b/tensorflow/docs_src/install/install_sources.md
index fc1f6d05bd..3801fc0f83 100644
--- a/tensorflow/docs_src/install/install_sources.md
+++ b/tensorflow/docs_src/install/install_sources.md
@@ -338,10 +338,10 @@ Invoke `pip install` to install that pip package.
The filename of the `.whl` file depends on your platform.
For example, the following command will install the pip package
-for TensorFlow 1.9.0rc0 on Linux:
+for TensorFlow 1.9.0rc2 on Linux:
-$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.9.0rc0-py2-none-any.whl
+$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.9.0rc2-py2-none-any.whl
## Validate your installation
--
GitLab
From 9f3bd2cf1eccdc76ed1934ade96c6cd4464bb8b2 Mon Sep 17 00:00:00 2001
From: Mark Daoust
Date: Fri, 6 Jul 2018 05:46:42 -0700
Subject: [PATCH 076/519] lint fix
---
tensorflow/examples/tutorials/mnist/mnist_deep.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tensorflow/examples/tutorials/mnist/mnist_deep.py b/tensorflow/examples/tutorials/mnist/mnist_deep.py
index 47d2777813..5d8d8d84fe 100644
--- a/tensorflow/examples/tutorials/mnist/mnist_deep.py
+++ b/tensorflow/examples/tutorials/mnist/mnist_deep.py
@@ -170,7 +170,9 @@ def main(_):
accuracy_l = []
for _ in range(20):
batch = mnist.test.next_batch(500, shuffle=False)
- accuracy_l.append(accuracy.eval(feed_dict={x: batch[0], y_: batch[1], keep_prob: 1.0}))
+ accuracy_l.append(accuracy.eval(feed_dict={x: batch[0],
+ y_: batch[1],
+ keep_prob: 1.0}))
print('test accuracy %g' % numpy.mean(accuracy_l))
--
GitLab
From d33bc55210478d58b858704bfa92316860b777fa Mon Sep 17 00:00:00 2001
From: Amit Patankar
Date: Fri, 6 Jul 2018 09:27:31 -0700
Subject: [PATCH 077/519] Updating the version to 1.9.0 official.
---
tensorflow/core/public/version.h | 2 +-
tensorflow/docs_src/install/install_c.md | 2 +-
tensorflow/docs_src/install/install_go.md | 2 +-
tensorflow/docs_src/install/install_java.md | 22 +++++++++----------
tensorflow/docs_src/install/install_linux.md | 18 +++++++--------
tensorflow/docs_src/install/install_mac.md | 10 ++++-----
.../docs_src/install/install_sources.md | 4 ++--
tensorflow/tools/pip_package/setup.py | 2 +-
8 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/tensorflow/core/public/version.h b/tensorflow/core/public/version.h
index 0e4a61ac1f..cea5e8ffb0 100644
--- a/tensorflow/core/public/version.h
+++ b/tensorflow/core/public/version.h
@@ -24,7 +24,7 @@ limitations under the License.
// TF_VERSION_SUFFIX is non-empty for pre-releases (e.g. "-alpha", "-alpha.1",
// "-beta", "-rc", "-rc.1")
-#define TF_VERSION_SUFFIX "-rc2"
+#define TF_VERSION_SUFFIX ""
#define TF_STR_HELPER(x) #x
#define TF_STR(x) TF_STR_HELPER(x)
diff --git a/tensorflow/docs_src/install/install_c.md b/tensorflow/docs_src/install/install_c.md
index 9aebf2bfa4..362a03cd56 100644
--- a/tensorflow/docs_src/install/install_c.md
+++ b/tensorflow/docs_src/install/install_c.md
@@ -38,7 +38,7 @@ enable TensorFlow for C:
OS="linux" # Change to "darwin" for macOS
TARGET_DIRECTORY="/usr/local"
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-${OS}-x86_64-1.9.0-rc2.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-${OS}-x86_64-1.9.0.tar.gz" |
sudo tar -C $TARGET_DIRECTORY -xz
The `tar` command extracts the TensorFlow C library into the `lib`
diff --git a/tensorflow/docs_src/install/install_go.md b/tensorflow/docs_src/install/install_go.md
index 1907355341..a4f2e5733b 100644
--- a/tensorflow/docs_src/install/install_go.md
+++ b/tensorflow/docs_src/install/install_go.md
@@ -38,7 +38,7 @@ steps to install this library and enable TensorFlow for Go:
TF_TYPE="cpu" # Change to "gpu" for GPU support
TARGET_DIRECTORY='/usr/local'
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-$(go env GOOS)-x86_64-1.9.0-rc2.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-$(go env GOOS)-x86_64-1.9.0.tar.gz" |
sudo tar -C $TARGET_DIRECTORY -xz
The `tar` command extracts the TensorFlow C library into the `lib`
diff --git a/tensorflow/docs_src/install/install_java.md b/tensorflow/docs_src/install/install_java.md
index b9c9912816..643c3b715f 100644
--- a/tensorflow/docs_src/install/install_java.md
+++ b/tensorflow/docs_src/install/install_java.md
@@ -36,7 +36,7 @@ following to the project's `pom.xml` to use the TensorFlow Java APIs:
org.tensorflow
tensorflow
- 1.9.0-rc2
+ 1.9.0
```
@@ -65,7 +65,7 @@ As an example, these steps will create a Maven project that uses TensorFlow:
org.tensorflow
tensorflow
- 1.9.0-rc2
+ 1.9.0
@@ -124,12 +124,12 @@ instead:
org.tensorflow
libtensorflow
- 1.9.0-rc2
+ 1.9.0
org.tensorflow
libtensorflow_jni_gpu
- 1.9.0-rc2
+ 1.9.0
```
@@ -148,7 +148,7 @@ refer to the simpler instructions above instead.
Take the following steps to install TensorFlow for Java on Linux or macOS:
1. Download
- [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc2.jar),
+ [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0.jar),
which is the TensorFlow Java Archive (JAR).
2. Decide whether you will run TensorFlow for Java on CPU(s) only or with
@@ -167,7 +167,7 @@ Take the following steps to install TensorFlow for Java on Linux or macOS:
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
mkdir -p ./jni
curl -L \
- "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-${TF_TYPE}-${OS}-x86_64-1.9.0-rc2.tar.gz" |
+ "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-${TF_TYPE}-${OS}-x86_64-1.9.0.tar.gz" |
tar -xz -C ./jni
### Install on Windows
@@ -175,10 +175,10 @@ Take the following steps to install TensorFlow for Java on Linux or macOS:
Take the following steps to install TensorFlow for Java on Windows:
1. Download
- [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0-rc2.jar),
+ [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.9.0.jar),
which is the TensorFlow Java Archive (JAR).
2. Download the following Java Native Interface (JNI) file appropriate for
- [TensorFlow for Java on Windows](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-cpu-windows-x86_64-1.9.0-rc2.zip).
+ [TensorFlow for Java on Windows](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-cpu-windows-x86_64-1.9.0.zip).
3. Extract this .zip file.
@@ -227,7 +227,7 @@ must be part of your `classpath`. For example, you can include the
downloaded `.jar` in your `classpath` by using the `-cp` compilation flag
as follows:
-javac -cp libtensorflow-1.9.0-rc2.jar HelloTF.java
+javac -cp libtensorflow-1.9.0.jar HelloTF.java
### Running
@@ -241,11 +241,11 @@ two files are available to the JVM:
For example, the following command line executes the `HelloTF` program on Linux
and macOS X:
-java -cp libtensorflow-1.9.0-rc2.jar:. -Djava.library.path=./jni HelloTF
+java -cp libtensorflow-1.9.0.jar:. -Djava.library.path=./jni HelloTF
And the following command line executes the `HelloTF` program on Windows:
-java -cp libtensorflow-1.9.0-rc2.jar;. -Djava.library.path=jni HelloTF
+java -cp libtensorflow-1.9.0.jar;. -Djava.library.path=jni HelloTF
If the program prints Hello from version, you've successfully
installed TensorFlow for Java and are ready to use the API. If the program
diff --git a/tensorflow/docs_src/install/install_linux.md b/tensorflow/docs_src/install/install_linux.md
index ae3d50ff39..abec8ca072 100644
--- a/tensorflow/docs_src/install/install_linux.md
+++ b/tensorflow/docs_src/install/install_linux.md
@@ -438,7 +438,7 @@ Take the following steps to install TensorFlow in an Anaconda environment:
(tensorflow)$ pip install --ignore-installed --upgrade \
- https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp34-cp34m-linux_x86_64.whl
+ https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0-cp34-cp34m-linux_x86_64.whl
## Validate your installation
@@ -678,14 +678,14 @@ This section documents the relevant values for Linux installations.
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp27-none-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0-cp27-none-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp27-none-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0-cp27-none-linux_x86_64.whl
Note that GPU support requires the NVIDIA hardware and software described in
@@ -697,14 +697,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp34-cp34m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0-cp34-cp34m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp34-cp34m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0-cp34-cp34m-linux_x86_64.whl
Note that GPU support requires the NVIDIA hardware and software described in
@@ -716,14 +716,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp35-cp35m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0-cp35-cp35m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp35-cp35m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0-cp35-cp35m-linux_x86_64.whl
@@ -735,14 +735,14 @@ Note that GPU support requires the NVIDIA hardware and software described in
CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0rc2-cp36-cp36m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.9.0-cp36-cp36m-linux_x86_64.whl
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0rc2-cp36-cp36m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.9.0-cp36-cp36m-linux_x86_64.whl
diff --git a/tensorflow/docs_src/install/install_mac.md b/tensorflow/docs_src/install/install_mac.md
index 3de6da1342..167d17adb4 100644
--- a/tensorflow/docs_src/install/install_mac.md
+++ b/tensorflow/docs_src/install/install_mac.md
@@ -119,7 +119,7 @@ Take the following steps to install TensorFlow with Virtualenv:
TensorFlow in the active Virtualenv is as follows:
$ pip3 install --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py3-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0-py3-none-any.whl
If you encounter installation problems, see
[Common Installation Problems](#common-installation-problems).
@@ -242,7 +242,7 @@ take the following steps:
issue the following command:
$ sudo pip3 install --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py3-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0-py3-none-any.whl
If the preceding command fails, see
[installation problems](#common-installation-problems).
@@ -350,7 +350,7 @@ Take the following steps to install TensorFlow in an Anaconda environment:
TensorFlow for Python 2.7:
(targetDirectory)$ pip install --ignore-installed --upgrade \
- https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py2-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0-py2-none-any.whl
@@ -518,7 +518,7 @@ The value you specify depends on your Python version.
-https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py2-none-any.whl
+https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0-py2-none-any.whl
@@ -526,5 +526,5 @@ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py2-none-a
-https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0rc2-py3-none-any.whl
+https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.9.0-py3-none-any.whl
diff --git a/tensorflow/docs_src/install/install_sources.md b/tensorflow/docs_src/install/install_sources.md
index 3520f97c9a..79da209928 100644
--- a/tensorflow/docs_src/install/install_sources.md
+++ b/tensorflow/docs_src/install/install_sources.md
@@ -328,10 +328,10 @@ Invoke `pip install` to install that pip package.
The filename of the `.whl` file depends on your platform.
For example, the following command will install the pip package
-for TensorFlow 1.9.0rc2 on Linux:
+for TensorFlow 1.9.0 on Linux:
-$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.9.0rc2-py2-none-any.whl
+$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.9.0-py2-none-any.whl
## Validate your installation
diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py
index 8c077580aa..dc9d059bab 100644
--- a/tensorflow/tools/pip_package/setup.py
+++ b/tensorflow/tools/pip_package/setup.py
@@ -45,7 +45,7 @@ DOCLINES = __doc__.split('\n')
# This version string is semver compatible, but incompatible with pip.
# For pip, we will remove all '-' characters from this string, and use the
# result for pip.
-_VERSION = '1.9.0-rc2'
+_VERSION = '1.9.0'
REQUIRED_PACKAGES = [
'absl-py >= 0.1.6',
--
GitLab
From a522d458dacd3a34c4ff2e6b76556f623fe7dbd6 Mon Sep 17 00:00:00 2001
From: Gunhan Gulsoy
Date: Fri, 29 Jun 2018 22:43:22 -0700
Subject: [PATCH 078/519] Remove unused gcp and hdfs config flags, as these are
on by default now.
PiperOrigin-RevId: 202753310
---
tensorflow/tools/ci_build/ci_parameterized_build.sh | 2 +-
tensorflow/tools/ci_build/ci_sanity.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tensorflow/tools/ci_build/ci_parameterized_build.sh b/tensorflow/tools/ci_build/ci_parameterized_build.sh
index e621f85652..6aaeb14aee 100755
--- a/tensorflow/tools/ci_build/ci_parameterized_build.sh
+++ b/tensorflow/tools/ci_build/ci_parameterized_build.sh
@@ -132,7 +132,7 @@ BAZEL_CMD="bazel test"
BAZEL_BUILD_ONLY_CMD="bazel build"
BAZEL_CLEAN_CMD="bazel clean"
-DEFAULT_BAZEL_CONFIGS="--config=gcp --config=hdfs"
+DEFAULT_BAZEL_CONFIGS=""
PIP_CMD="${CI_BUILD_DIR}/builds/pip.sh"
PIP_TEST_TUTORIALS_FLAG="--test_tutorials"
diff --git a/tensorflow/tools/ci_build/ci_sanity.sh b/tensorflow/tools/ci_build/ci_sanity.sh
index 05676f9551..0dd32ad1a8 100755
--- a/tensorflow/tools/ci_build/ci_sanity.sh
+++ b/tensorflow/tools/ci_build/ci_sanity.sh
@@ -543,7 +543,7 @@ SANITY_STEPS=("do_pylint PYTHON2" "do_pylint PYTHON3" "do_check_futures_test" "d
SANITY_STEPS_DESC=("Python 2 pylint" "Python 3 pylint" "Check that python files have certain __future__ imports" "buildifier check" "bazel nobuild" "pip: license check for external dependencies" "C library: license check for external dependencies" "Java Native Library: license check for external dependencies" "Pip Smoke Test: Checking py_test dependencies exist in pip package" "Check load py_test: Check that BUILD files with py_test target properly load py_test" "Code Link Check: Check there are no broken links" "Test entries in /tensorflow/contrib/cmake/python_{modules|protos|protos_cc}.txt for validity and consistency" "Check file names for cases")
INCREMENTAL_FLAG=""
-DEFAULT_BAZEL_CONFIGS="--config=hdfs --config=gcp"
+DEFAULT_BAZEL_CONFIGS=""
# Parse command-line arguments
BAZEL_FLAGS=${DEFAULT_BAZEL_CONFIGS}
--
GitLab
From 1107fb018307dfdc35fbe1c2d2f2a378c45aeb18 Mon Sep 17 00:00:00 2001
From: Tristan Rice
Date: Wed, 20 Jun 2018 13:19:50 -0700
Subject: [PATCH 079/519] Cast: support casting to and from quantized types
---
tensorflow/core/framework/tensor.h | 1 +
tensorflow/core/kernels/cast_op.cc | 53 +++++++++++++++----
tensorflow/core/kernels/cast_op.h | 2 +
tensorflow/core/kernels/cast_op_test.cc | 12 ++++-
.../kernel_tests/distributions/util_test.py | 4 +-
5 files changed, 61 insertions(+), 11 deletions(-)
diff --git a/tensorflow/core/framework/tensor.h b/tensorflow/core/framework/tensor.h
index d2f2609d3b..1b19ab5da3 100644
--- a/tensorflow/core/framework/tensor.h
+++ b/tensorflow/core/framework/tensor.h
@@ -482,6 +482,7 @@ class Tensor {
friend class VariableOp; // For access to set_shape
friend class AutoReloadVariableOp; // For access to set_shape
friend class TensorTestHelper; // For access to set_shape
+ friend class CastOpBase; // For access to set_dtype;
friend class OpKernelContext; // For access to RefCountIsOne().
friend class ScopedAllocator; // For access to buf_.
friend class XlaTensor; // For access to RefCountIsOne().
diff --git a/tensorflow/core/kernels/cast_op.cc b/tensorflow/core/kernels/cast_op.cc
index 626db9131a..85b8a5ea6b 100644
--- a/tensorflow/core/kernels/cast_op.cc
+++ b/tensorflow/core/kernels/cast_op.cc
@@ -53,8 +53,39 @@ typedef Eigen::SyclDevice SYCLDevice;
FN(arg0, std::complex)
CastOpBase::CastOpBase(OpKernelConstruction* ctx) : OpKernel(ctx) {
- OP_REQUIRES_OK(ctx, ctx->GetAttr("SrcT", &src_dtype_));
- OP_REQUIRES_OK(ctx, ctx->GetAttr("DstT", &dst_dtype_));
+ OP_REQUIRES_OK(ctx, ctx->GetAttr("SrcT", &external_src_dtype_));
+
+ OP_REQUIRES_OK(ctx, ctx->GetAttr("DstT", &external_dst_dtype_));
+
+ // Quantized data types use the same underlying format as their non quantized
+ // version so we use the non quantized implementation for casting.
+ if (external_dst_dtype_ == DT_QUINT8) {
+ dst_dtype_ = DT_UINT8;
+ } else if (external_dst_dtype_ == DT_QINT8) {
+ dst_dtype_ = DT_INT8;
+ } else if (external_dst_dtype_ == DT_QINT32) {
+ dst_dtype_ = DT_INT32;
+ } else if (external_dst_dtype_ == DT_QINT16) {
+ dst_dtype_ = DT_INT16;
+ } else if (external_dst_dtype_ == DT_QUINT16) {
+ dst_dtype_ = DT_UINT16;
+ } else {
+ dst_dtype_ = external_dst_dtype_;
+ }
+
+ if (external_src_dtype_ == DT_QUINT8) {
+ src_dtype_ = DT_UINT8;
+ } else if (external_src_dtype_ == DT_QINT8) {
+ src_dtype_ = DT_INT8;
+ } else if (external_src_dtype_ == DT_QINT32) {
+ src_dtype_ = DT_INT32;
+ } else if (external_src_dtype_ == DT_QINT16) {
+ src_dtype_ = DT_INT16;
+ } else if (external_src_dtype_ == DT_QUINT16) {
+ src_dtype_ = DT_UINT16;
+ } else {
+ src_dtype_ = external_src_dtype_;
+ }
}
void CastOpBase::Compute(OpKernelContext* ctx) {
@@ -62,15 +93,19 @@ void CastOpBase::Compute(OpKernelContext* ctx) {
if (work_ == nullptr) {
ctx->set_output(0, inp);
} else {
+ Tensor in;
+ in.UnsafeCopyFromInternal(inp, src_dtype_, inp.shape());
Tensor* out = nullptr;
- OP_REQUIRES_OK(ctx, ctx->allocate_output(0, inp.shape(), &out));
- work_(ctx, inp, out);
+ OP_REQUIRES_OK(ctx, ctx->allocate_output(0, in.shape(), &out));
+ out->set_dtype(dst_dtype_);
+ work_(ctx, in, out);
+ out->set_dtype(external_dst_dtype_);
}
}
Status CastOpBase::Unimplemented() {
- return errors::Unimplemented("Cast ", DataTypeString(src_dtype_), " to ",
- DataTypeString(dst_dtype_), " is not supported");
+ return errors::Unimplemented("Cast ", DataTypeString(external_src_dtype_), " to ",
+ DataTypeString(external_dst_dtype_), " is not supported");
}
CpuCastOp::CpuCastOp(OpKernelConstruction* ctx) : CastOpBase(ctx) {
@@ -78,7 +113,7 @@ CpuCastOp::CpuCastOp(OpKernelConstruction* ctx) : CastOpBase(ctx) {
}
Status CpuCastOp::Prepare() {
- if (src_dtype_ == dst_dtype_) {
+ if (external_src_dtype_ == external_dst_dtype_) {
work_ = nullptr; // Identity
return Status::OK();
}
@@ -127,7 +162,7 @@ class GpuCastOp : public CastOpBase {
private:
Status Prepare() {
- if (src_dtype_ == dst_dtype_) {
+ if (external_src_dtype_ == external_dst_dtype_) {
work_ = nullptr; // Identity
return Status::OK();
}
@@ -203,7 +238,7 @@ class SyclCastOp : public CastOpBase {
private:
Status Prepare() {
- if (src_dtype_ == dst_dtype_) {
+ if (external_src_dtype_ == external_dst_dtype_) {
work_ = nullptr; // Identity
return Status::OK();
}
diff --git a/tensorflow/core/kernels/cast_op.h b/tensorflow/core/kernels/cast_op.h
index 16d2e0e0a5..aae1e7ff19 100644
--- a/tensorflow/core/kernels/cast_op.h
+++ b/tensorflow/core/kernels/cast_op.h
@@ -36,6 +36,8 @@ class CastOpBase : public OpKernel {
protected:
DataType src_dtype_;
DataType dst_dtype_;
+ DataType external_src_dtype_;
+ DataType external_dst_dtype_;
std::function work_ = nullptr;
Status Unimplemented();
diff --git a/tensorflow/core/kernels/cast_op_test.cc b/tensorflow/core/kernels/cast_op_test.cc
index 7da9d28a3d..b74dc25837 100644
--- a/tensorflow/core/kernels/cast_op_test.cc
+++ b/tensorflow/core/kernels/cast_op_test.cc
@@ -76,7 +76,12 @@ class CastOpTest : public OpsTestBase {
TEST_CAST(in, half); \
TEST_CAST(in, float); \
TEST_CAST(in, double); \
- TEST_CAST(in, bfloat16);
+ TEST_CAST(in, bfloat16); \
+ TEST_CAST(in, quint8); \
+ TEST_CAST(in, qint8); \
+ TEST_CAST(in, qint32); \
+ TEST_CAST(in, qint16); \
+ TEST_CAST(in, quint16);
TEST_ALL_CASTS_FROM(uint8)
TEST_ALL_CASTS_FROM(uint16)
@@ -87,6 +92,11 @@ TEST_ALL_CASTS_FROM(half)
TEST_ALL_CASTS_FROM(float)
TEST_ALL_CASTS_FROM(double)
TEST_ALL_CASTS_FROM(bfloat16)
+TEST_ALL_CASTS_FROM(quint8)
+TEST_ALL_CASTS_FROM(qint8)
+TEST_ALL_CASTS_FROM(qint32)
+TEST_ALL_CASTS_FROM(qint16)
+TEST_ALL_CASTS_FROM(quint16)
#undef TEST_ALL_CASTS_FROM
#undef TEST_CAST
diff --git a/tensorflow/python/kernel_tests/distributions/util_test.py b/tensorflow/python/kernel_tests/distributions/util_test.py
index 9d38ffcb4a..53f143abd6 100644
--- a/tensorflow/python/kernel_tests/distributions/util_test.py
+++ b/tensorflow/python/kernel_tests/distributions/util_test.py
@@ -311,8 +311,10 @@ class EmbedCheckCategoricalEventShapeTest(test.TestCase):
@test_util.run_in_graph_and_eager_modes
def testUnsupportedDtype(self):
with self.test_session():
+ param = ops.convert_to_tensor(
+ np.ones([2**11+1]).astype(dtypes.qint16.as_numpy_dtype),
+ dtype=dtypes.qint16)
with self.assertRaises(TypeError):
- param = array_ops.ones([int(2**11+1)], dtype=dtypes.qint16)
du.embed_check_categorical_event_shape(param)
--
GitLab
From a979fb29de16dff6495b51cb1363eea752b43513 Mon Sep 17 00:00:00 2001
From: AG Ramesh
Date: Sun, 8 Jul 2018 20:38:26 -0700
Subject: [PATCH 080/519] Add reorder primitive reuse
---
tensorflow/core/kernels/mkl_conv_grad_filter_ops.cc | 10 +++-------
tensorflow/core/kernels/mkl_conv_grad_input_ops.cc | 7 ++-----
2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/tensorflow/core/kernels/mkl_conv_grad_filter_ops.cc b/tensorflow/core/kernels/mkl_conv_grad_filter_ops.cc
index 4e80f5acce..87849e48b8 100644
--- a/tensorflow/core/kernels/mkl_conv_grad_filter_ops.cc
+++ b/tensorflow/core/kernels/mkl_conv_grad_filter_ops.cc
@@ -872,12 +872,11 @@ class MklConv2DCustomBackpropFilterOp
}
// check if src and diff_dst need reorder
- std::vector net;
T *src_data = nullptr;
if (fwd_src_md.data.format != conv2d_bwd_filter->GetSrcMemoryFormat()) {
src.SetUsrMem(fwd_src_md, &src_tensor);
src.CheckReorderToOpMem(
- bwd_filter_pd->src_primitive_desc(), &net);
+ bwd_filter_pd->src_primitive_desc());
src_data = static_cast(src.GetOpMem().get_data_handle());
} else {
src_data = static_cast(const_cast(
@@ -889,14 +888,13 @@ class MklConv2DCustomBackpropFilterOp
conv2d_bwd_filter->GetDiffDstMemoryFormat()) {
diff_dst.SetUsrMem(diff_dst_md, &diff_dst_tensor);
diff_dst.CheckReorderToOpMem(
- bwd_filter_pd->diff_dst_primitive_desc(), &net);
+ bwd_filter_pd->diff_dst_primitive_desc());
diff_dst_data = static_cast(
diff_dst.GetOpMem().get_data_handle());
} else {
diff_dst_data = static_cast(const_cast(
diff_dst_tensor.flat().data()));
}
- stream(stream::kind::eager).submit(net).wait();
// For backward filter, convert diff_filter back to Tensorflow layout
// Here we prepare to reorder op memory back to user memory
@@ -929,9 +927,7 @@ class MklConv2DCustomBackpropFilterOp
// Reorder diff_filter back to Tensorflow layout if necessary
if (diff_filter_reorder_required) {
- std::vector net;
- diff_filter.InsertReorderToUserMem(&net);
- stream(stream::kind::eager).submit(net).wait();
+ diff_filter.InsertReorderToUserMem();
}
} catch (mkldnn::error& e) {
string error_msg = "Status: " + std::to_string(e.status) +
diff --git a/tensorflow/core/kernels/mkl_conv_grad_input_ops.cc b/tensorflow/core/kernels/mkl_conv_grad_input_ops.cc
index 0af4568b47..60a048779f 100644
--- a/tensorflow/core/kernels/mkl_conv_grad_input_ops.cc
+++ b/tensorflow/core/kernels/mkl_conv_grad_input_ops.cc
@@ -722,14 +722,12 @@ class MklConv2DCustomBackpropInputOp
diff_src_tensor->flat().data()));
// check if filter and diff_dst need reorder
- std::vector net;
T* filter_data = nullptr;
if (fwd_filter_md.data.format !=
conv2d_bwd_input->GetFilterMemoryFormat()) {
filter.SetUsrMem(fwd_filter_md, &filter_tensor);
filter.CheckReorderToOpMem(
- bwd_input_pd->weights_primitive_desc(),
- &net);
+ bwd_input_pd->weights_primitive_desc());
filter_data = static_cast(filter.GetOpMem().get_data_handle());
} else {
filter_data = static_cast(const_cast(
@@ -741,14 +739,13 @@ class MklConv2DCustomBackpropInputOp
conv2d_bwd_input->GetDiffDstMemoryFormat()) {
diff_dst.SetUsrMem(diff_dst_md, &diff_dst_tensor);
diff_dst.CheckReorderToOpMem(
- bwd_input_pd->diff_dst_primitive_desc(), &net);
+ bwd_input_pd->diff_dst_primitive_desc());
diff_dst_data = static_cast(
diff_dst.GetOpMem().get_data_handle());
} else {
diff_dst_data = static_cast(const_cast(
diff_dst_tensor.flat().data()));
}
- stream(stream::kind::eager).submit(net).wait();
// execute convolution input bwd
conv2d_bwd_input->Execute(diff_src_data, filter_data, diff_dst_data);
--
GitLab
From 1466b2eb0b545241b3abd5bcf229bcb0494da6b2 Mon Sep 17 00:00:00 2001
From: Yong Tang
Date: Mon, 4 Jun 2018 15:58:18 +0000
Subject: [PATCH 081/519] Add complex support for tan
At the moment tan in tensorflow supports float and double, but
not complex types.
This fix adds the support for tan, and removes related TODO in
the test
Signed-off-by: Yong Tang
---
tensorflow/core/kernels/cwise_op_tan.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tensorflow/core/kernels/cwise_op_tan.cc b/tensorflow/core/kernels/cwise_op_tan.cc
index c1a25767d3..ce90145c70 100644
--- a/tensorflow/core/kernels/cwise_op_tan.cc
+++ b/tensorflow/core/kernels/cwise_op_tan.cc
@@ -16,7 +16,7 @@ limitations under the License.
#include "tensorflow/core/kernels/cwise_ops_common.h"
namespace tensorflow {
-REGISTER2(UnaryOp, CPU, "Tan", functor::tan, float, double);
+REGISTER4(UnaryOp, CPU, "Tan", functor::tan, float, double, complex64, complex128);
#if GOOGLE_CUDA
REGISTER2(UnaryOp, GPU, "Tan", functor::tan, float, double);
--
GitLab
From 9249690173fe4bf46f2fc170f3e68f5496d7609c Mon Sep 17 00:00:00 2001
From: Yong Tang
Date: Mon, 4 Jun 2018 15:59:36 +0000
Subject: [PATCH 082/519] Remove TODO and enable complex for tan in test case.
Signed-off-by: Yong Tang
---
tensorflow/cc/gradients/math_grad_test.cc | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/tensorflow/cc/gradients/math_grad_test.cc b/tensorflow/cc/gradients/math_grad_test.cc
index fd7b6fe662..1c9bdff5e1 100644
--- a/tensorflow/cc/gradients/math_grad_test.cc
+++ b/tensorflow/cc/gradients/math_grad_test.cc
@@ -475,11 +475,7 @@ TEST_F(CWiseUnaryGradTest, Tan_Complex) {
auto x_fn = [this](const int i) {
return CRV({{1, 0}, {0, 1}, {2, -1}, {1, 2}, {3, 4}});
};
- // TODO(kbsriram)
- // Enable when tan kernel supports complex inputs
- if (false) {
- TestCWiseGrad(TAN, x_fn);
- }
+ TestCWiseGrad(TAN, x_fn);
}
TEST_F(CWiseUnaryGradTest, Atan) {
--
GitLab
From 00dbde11f428953cc34c933051692178820d28e1 Mon Sep 17 00:00:00 2001
From: SneakyFish5 <32284796+SneakyFish5@users.noreply.github.com>
Date: Wed, 11 Jul 2018 15:35:19 -0500
Subject: [PATCH 083/519] Fix copied buffer
---
tensorflow/contrib/lite/allocation.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tensorflow/contrib/lite/allocation.cc b/tensorflow/contrib/lite/allocation.cc
index c42622ff02..6aa4b57d7c 100644
--- a/tensorflow/contrib/lite/allocation.cc
+++ b/tensorflow/contrib/lite/allocation.cc
@@ -99,7 +99,7 @@ FileCopyAllocation::FileCopyAllocation(const char* filename,
filename);
return;
}
- copied_buffer_ = std::move(buffer);
+ copied_buffer_.reset(const_cast(buffer.release()));
}
FileCopyAllocation::~FileCopyAllocation() {}
--
GitLab
From 571d3dc5747e04fe0a80be185e64532cf74e1fb0 Mon Sep 17 00:00:00 2001
From: gracehoney <31743510+aaroey@users.noreply.github.com>
Date: Wed, 11 Jul 2018 23:54:26 -0700
Subject: [PATCH 084/519] Let segmenter able to remove ineligible input/output
nodes.
---
.../contrib/tensorrt/convert/convert_graph.cc | 9 +-
.../contrib/tensorrt/convert/convert_nodes.cc | 8 +
.../contrib/tensorrt/convert/convert_nodes.h | 4 +
.../contrib/tensorrt/segment/segment.cc | 186 +++++--
tensorflow/contrib/tensorrt/segment/segment.h | 20 +-
.../contrib/tensorrt/segment/segment_test.cc | 460 +++++++-----------
6 files changed, 338 insertions(+), 349 deletions(-)
diff --git a/tensorflow/contrib/tensorrt/convert/convert_graph.cc b/tensorflow/contrib/tensorrt/convert/convert_graph.cc
index 1c4fd4a0ce..359fac36f5 100644
--- a/tensorflow/contrib/tensorrt/convert/convert_graph.cc
+++ b/tensorflow/contrib/tensorrt/convert/convert_graph.cc
@@ -107,8 +107,10 @@ bool IsTensorRTCandidate(const tensorflow::Node* node) {
// TODO(ben,jie): ...
};
// LINT.ThenChange(//tensorflow/contrib/tensorrt/convert/convert_nodes.h)
- return (candidate_ops.count(node->type_string()) ||
- PluginFactoryTensorRT::GetInstance()->IsPlugin(node->type_string()));
+ if (!candidate_ops.count(node->type_string()) &&
+ !PluginFactoryTensorRT::GetInstance()->IsPlugin(node->type_string())) {
+ return false;
+ }
}
tensorflow::Status BuildNodeMap(
@@ -720,7 +722,8 @@ tensorflow::Status ConvertAfterShapes(ConversionParams& params) {
segment_options.minimum_segment_size = params.minimum_segment_size;
tensorflow::tensorrt::segment::SegmentNodesVector initial_segments;
TF_RETURN_IF_ERROR(tensorrt::segment::SegmentGraph(
- &graph, IsTensorRTCandidate, segment_options, &initial_segments));
+ &graph, IsTensorRTCandidate, IsTensorRTInputCandidate,
+ IsTensorRTOutputCandidate, segment_options, &initial_segments));
if (initial_segments.size() > 1) {
VLOG(0) << "MULTIPLE tensorrt candidate conversion: "
<< initial_segments.size();
diff --git a/tensorflow/contrib/tensorrt/convert/convert_nodes.cc b/tensorflow/contrib/tensorrt/convert/convert_nodes.cc
index 146b9c7344..8f6656e4ad 100644
--- a/tensorflow/contrib/tensorrt/convert/convert_nodes.cc
+++ b/tensorflow/contrib/tensorrt/convert/convert_nodes.cc
@@ -2391,6 +2391,14 @@ tensorflow::Status ConvertSegmentToGraphDef(
return tensorflow::Status::OK();
}
+bool IsTensorRTInputCandidate(const tensorflow::Node* node) {
+ return true;
+}
+
+bool IsTensorRTOutputCandidate(const tensorflow::Node* node) {
+ return true;
+}
+
} // namespace convert
} // namespace tensorrt
} // namespace tensorflow
diff --git a/tensorflow/contrib/tensorrt/convert/convert_nodes.h b/tensorflow/contrib/tensorrt/convert/convert_nodes.h
index 7684d8d4a2..872ba6a080 100644
--- a/tensorflow/contrib/tensorrt/convert/convert_nodes.h
+++ b/tensorflow/contrib/tensorrt/convert/convert_nodes.h
@@ -128,6 +128,10 @@ tensorflow::Status ConvertGraphDefToEngine(
TrtUniquePtrType* engine,
bool* convert_successfully);
+bool IsTensorRTInputCandidate(const tensorflow::Node* node);
+
+bool IsTensorRTOutputCandidate(const tensorflow::Node* node);
+
} // namespace convert
} // namespace tensorrt
} // namespace tensorflow
diff --git a/tensorflow/contrib/tensorrt/segment/segment.cc b/tensorflow/contrib/tensorrt/segment/segment.cc
index cc42913eca..5c0898b29a 100644
--- a/tensorflow/contrib/tensorrt/segment/segment.cc
+++ b/tensorflow/contrib/tensorrt/segment/segment.cc
@@ -15,6 +15,7 @@ limitations under the License.
#include "tensorflow/contrib/tensorrt/segment/segment.h"
+#include
#include
#include
#include
@@ -32,6 +33,7 @@ namespace tensorflow {
namespace tensorrt {
namespace segment {
using ::tensorflow::strings::StrAppend;
+
// A simple graph representation to mirror tensorflow::Graph. This structure
// helps saving memory since segmenter modifies the graph in place, preventing
// the need to create a copy of the graph. It is composed of edges and nodes.
@@ -215,7 +217,7 @@ namespace {
bool CheckCycles(const std::unique_ptr& g, const SimpleNode* src,
const std::vector& start) {
- // copied from TF ReverseDFS.
+ // Copied from TF ReverseDFS, which only works for tensorflow::Graph.
struct Work {
SimpleNode* node;
bool leave; // Are we entering or leaving n?
@@ -269,6 +271,24 @@ bool CanContractEdge(const SimpleEdge* edge,
// 1. Get all nodes incoming to 'dst', excluding 'src'
// 2. Reverse DFS from those nodes
// 3. If reverse DFS reaches 'src' then we have a cycle
+ //
+ // TODO(aaroey): there are several problems with the current approach:
+ // 1. src->dst->src, this is not detected but it should be;
+ // 2. src->dst->...(any node sequence that doesn't contain src)...->dst, this
+ // is detected but it should not be.
+ //
+ // Note that it's fine that dst connects back to src indirectly (i.e. through
+ // a path with length > 1 that consists of intermedia nodes other than src).
+ // While loops is one example.
+ //
+ // The goal is to make sure that the trt subgraph:
+ // 1. has no loops (i.e. is a DAG), and
+ // 2. if there is a path in the subgraph from X to Y (X and Y are both nodes
+ // in the subgraph), then all paths from X to Y are in the subgraph.
+ //
+ // To achieve this goal, the correct way seems to be:
+ // 1. remove any direct edge from src->dst;
+ // 2. detect if src can reach dst, if so they cannot be merged.
std::vector dfs_start_nodes;
for (SimpleNode* node : dst->in_nodes()) {
if (node != src) {
@@ -276,8 +296,8 @@ bool CanContractEdge(const SimpleEdge* edge,
}
}
- bool is_cycle = CheckCycles(graph, src, dfs_start_nodes);
- return !is_cycle;
+ const bool has_cycle = CheckCycles(graph, src, dfs_start_nodes);
+ return !has_cycle;
}
} // namespace
@@ -342,22 +362,20 @@ void ContractEdge(SimpleEdge* edge, SimpleGraph* graph,
}
tensorflow::Status SegmentGraph(
- const tensorflow::GraphDef& gdef,
- const std::function& candidate_fn,
- const SegmentOptions& options, SegmentNodesVector* segments) {
- // Create a Graph representation of the GraphDef.
- tensorflow::FunctionLibraryDefinition flib(tensorflow::OpRegistry::Global(),
- gdef.library());
- tensorflow::Graph graph(flib);
- TF_RETURN_IF_ERROR(tensorflow::ConvertGraphDefToGraph(
- tensorflow::GraphConstructorOptions(), gdef, &graph));
- return SegmentGraph(&graph, candidate_fn, options, segments);
-}
-
-tensorflow::Status SegmentGraph(
- tensorflow::Graph* tf_graph,
+ const tensorflow::Graph* tf_graph,
const std::function& candidate_fn,
+ const std::function& input_candidate_fn,
+ const std::function& output_candidate_fn,
const SegmentOptions& options, SegmentNodesVector* segments) {
+ // Steps:
+ // 1. run the segmentation algorithm to find all the segments, which uses
+ // candidate_fn to determine the candidates segment nodes;
+ // 2. for each segments, remove the nodes that are inputs/outputs of the
+ // segment but are not eligible, using input/output_candidate_fn to
+ // determine the eligibilities;
+ // 3. convert the segment into expected return format and return the result.
+
+ // --------------------------------- Step 1 ---------------------------------
auto graph = std::unique_ptr(new SimpleGraph(tf_graph));
// Use a union-find to collect the nodes that belong to the same
// segment. A node value of nullptr indicates that the node is not a candidate
@@ -372,14 +390,19 @@ tensorflow::Status SegmentGraph(
node_segments.emplace_back(node);
}
- // The segmentation algorithm below visits nodes in reverse
- // topological order and attempts to merge nodes along output
- // edges. That means that subgraphs grow from the output-side of the
- // network towards the inputs. In general this is not guaranteed to
- // produce a globally optimal segmentation. In the future if we have
- // a measure of how beneficial it is to include a given node in a
- // TRT subgraph then we can revisit this algorithm to take advantage
- // of that information.
+ // The segmentation algorithm below visits nodes in reverse topological order
+ // and attempts to merge nodes along output edges. That means that subgraphs
+ // grow from the output-side of the network towards the inputs.
+ //
+ // In general this is not guaranteed to produce a globally optimal
+ // segmentation. For exaample, consider graph with node {A, B, C, D} and edges
+ // {A->B, A->C, B->D, C->D), where A, B, D are trt compatible but C is not, so
+ // in theory we can choose to contract either A, B or B, D but not both, but
+ // here it always choose to contract B, D.
+ //
+ // In the future if we have a measure of how beneficial it is to include a
+ // given node in a TRT subgraph then we can revisit this algorithm to take
+ // advantage of that information.
std::vector tforder;
tensorflow::GetPostOrder(*tf_graph, &tforder);
// use postorder implementation from tensorflow and construct mirror in
@@ -392,13 +415,11 @@ tensorflow::Status SegmentGraph(
for (const SimpleNode* node : order) {
// All output nodes of 'node' have been visited...
VLOG(2) << "Trying node " << node->name() << " id=" << node->id();
-
// 'node' must be a TRT candidate...
if (node_segments[node->id()].Value() == nullptr) {
VLOG(2) << "... not a TRT candidate";
continue;
}
-
// Contract output edges to combine 'node' with output
// nodes. Iterate since combining two nodes may unblock other
// combining.
@@ -416,7 +437,6 @@ tensorflow::Status SegmentGraph(
VLOG(2) << "... ... not a TRT candidate";
continue;
}
-
if (CanContractEdge(out_edge, graph)) {
VLOG(2) << "... ... can contract";
contract_edges.insert(out_edge);
@@ -424,11 +444,9 @@ tensorflow::Status SegmentGraph(
VLOG(2) << "... ... cannot contract, would form cycle";
}
}
-
if (contract_edges.empty()) {
break;
}
-
// Contract edges and collect the adjacent nodes into the same
// segment/subgraph.
while (!contract_edges.empty()) {
@@ -457,11 +475,22 @@ tensorflow::Status SegmentGraph(
// Collect the segments/subgraphs. Each subgraph is represented by a
// set of the names of the nodes in that subgraph.
- std::unordered_map> sg_map;
+
+ // A map from the segment identifier (currently the name of the root node of
+ // the segment tree) to the segment nodes set.
+ std::unordered_map> sg_map;
+
+ // A map from the segment identifier (currently the name of the root node of
+ // the segment tree) to the device names that the nodes in the segment are
+ // assigned to.
+ //
+ // TODO(aaroey): nodes assigned to different devices should not be merged,
+ // fix this.
std::unordered_map> device_maps;
+
for (auto& u : node_segments) {
if ((u.Value() != nullptr) && (u.ParentValue() != nullptr)) {
- sg_map[u.ParentValue()->name()].insert(u.Value()->name());
+ sg_map[u.ParentValue()->name()].insert(u.Value()->tf_node());
auto tf_node = u.Value()->tf_node();
// has_assigned_device_name() is expected to return true
// when called from optimization pass. However, since graph
@@ -482,25 +511,104 @@ tensorflow::Status SegmentGraph(
}
}
+ // --------------------------------- Step 2 ---------------------------------
+ // Remove ineligible input/output nodes.
+ for (auto& itr : sg_map) {
+ std::set& segment_nodes = itr.second;
+ VLOG(1) << "Segment original size: " << segment_nodes.size();
+ while (true) {
+ std::deque in_nodes_que, out_nodes_que;
+ // Find an input node that is not eligible and add it to the queue.
+ // Nodes that has no incoming edges should not be treated as "input",
+ // as there are really no inputs to them. Similar for output nodes.
+ for (auto node : segment_nodes) {
+ bool added = false;
+ for (const tensorflow::Edge* edge : node->in_edges()) {
+ if (!edge->IsControlEdge() && !edge->src()->IsSource() &&
+ !segment_nodes.count(edge->src())) { // 'node' is an input node.
+ if (!input_candidate_fn(node)) {
+ in_nodes_que.push_back(node);
+ added = true;
+ break;
+ }
+ }
+ }
+ if (added) continue; // Only adding the node once to either queue.
+ for (const tensorflow::Edge* edge : node->out_edges()) {
+ if (!edge->dst()->IsSink() && !edge->IsControlEdge() &&
+ !segment_nodes.count(edge->dst())) { // 'node' is an output node.
+ if (!output_candidate_fn(node)) {
+ out_nodes_que.push_back(node);
+ break;
+ }
+ }
+ }
+ }
+ if (in_nodes_que.empty() && out_nodes_que.empty()) {
+ // No more ineligible input/output nodes.
+ break;
+ }
+ // Now for each ineligible node, remove all of its inputs or outputs from
+ // the subgraph.
+ //
+ // It can be proven that, if the original subgraph:
+ // 1. is a DAG, and
+ // 2. all paths between two nodes in the subgraph are all inside the
+ // subgraph
+ // then after doing this operation the resulting subgraph will keep the
+ // same properties 1 and 2.
+ //
+ // For simplicity we use heuristics: for input nodes remove all its
+ // input, for output nodes remove all its output. In this way, for common
+ // cases the number of removed nodes should be minimum.
+ auto remove_nodes = [&segment_nodes](
+ bool is_input_nodes,
+ std::deque* que) {
+ // Run a BFS on the queue to find all the input/output nodes.
+ std::set visited;
+ while (!que->empty()) {
+ auto node = que->front();
+ que->pop_front();
+ if (!visited.insert(node).second) continue;
+ segment_nodes.erase(node);
+ for (auto in : is_input_nodes ? node->in_nodes() : node->out_nodes()) {
+ if (segment_nodes.count(in)) {
+ que->push_back(in);
+ VLOG(2) << "Need to remove node " << in->name()
+ << " because one of its "
+ << (is_input_nodes ? "output" : "input")
+ << " nodes in the graph was removed: " << node->name();
+ }
+ }
+ }
+ };
+ remove_nodes(true, &in_nodes_que);
+ remove_nodes(false, &out_nodes_que);
+ }
+ VLOG(1) << "Segment new size: " << segment_nodes.size();
+ }
+
+ // --------------------------------- Step 3 ---------------------------------
// Convert the segments into the expected return format
for (const auto& itr : sg_map) {
- const auto& segment_node_names = itr.second;
+ const std::set& segment_nodes = itr.second;
if (VLOG_IS_ON(1)) {
string s;
- for (const auto& name : segment_node_names) {
- s += " " + name;
- }
- VLOG(1) << "Segment " << segments->size() << ":" << s;
+ for (auto node : segment_nodes) s += " " + node->name();
+ VLOG(1) << "Segment " << segments->size() << ": " << s;
}
// Don't use small segments.
- if (static_cast(segment_node_names.size()) <
+ if (static_cast(segment_nodes.size()) <
options.minimum_segment_size) {
VLOG(1) << "Segment " << segments->size() << " has only "
- << segment_node_names.size() << " nodes, dropping";
+ << segment_nodes.size() << " nodes, dropping";
continue;
}
+
// TODO(sami): Make segmenter placement aware once trtscopes are in place
+ std::set segment_node_names;
+ for (auto node : itr.second) segment_node_names.insert(node->name());
const auto& dev_itr = device_maps.find(itr.first);
if (dev_itr == device_maps.end() || dev_itr->second.empty()) {
VLOG(1) << "No device assigned to segment " << segments->size();
diff --git a/tensorflow/contrib/tensorrt/segment/segment.h b/tensorflow/contrib/tensorrt/segment/segment.h
index 81b4bfe49f..ab75135054 100644
--- a/tensorflow/contrib/tensorrt/segment/segment.h
+++ b/tensorflow/contrib/tensorrt/segment/segment.h
@@ -40,22 +40,6 @@ struct SegmentOptions {
std::set exclude_node_list;
};
-// Get the subgraphs of a graph that can be handled by TensorRT.
-//
-// @param gdef The GraphDef describing the network
-// @param candidate_fn A function that returns true for a NodeDef if
-// that node can be handled by TensorRT.
-// @param segments Returns the TensorRT segments/subgraphs. Each entry
-// in the vector describes a subgraph by giving a set of the names of
-// all the NodeDefs in that subgraph.
-// @return the status.
-//
-// TODO(aaroey): remove this method.
-tensorflow::Status SegmentGraph(
- const tensorflow::GraphDef& gdef,
- const std::function& candidate_fn,
- const SegmentOptions& options, SegmentNodesVector* segments);
-
// Get the subgraphs of a graph that can be handled by TensorRT.
//
// @param graph tensorflow::Graph of the network
@@ -66,8 +50,10 @@ tensorflow::Status SegmentGraph(
// all the NodeDefs in that subgraph.
// @return the status.
tensorflow::Status SegmentGraph(
- tensorflow::Graph* tf_graph,
+ const tensorflow::Graph* tf_graph,
const std::function& candidate_fn,
+ const std::function& input_candidate_fn,
+ const std::function& output_candidate_fn,
const SegmentOptions& options, SegmentNodesVector* segments);
} // namespace segment
diff --git a/tensorflow/contrib/tensorrt/segment/segment_test.cc b/tensorflow/contrib/tensorrt/segment/segment_test.cc
index f5b2d258d7..a43cf4f416 100644
--- a/tensorflow/contrib/tensorrt/segment/segment_test.cc
+++ b/tensorflow/contrib/tensorrt/segment/segment_test.cc
@@ -14,350 +14,230 @@ limitations under the License.
==============================================================================*/
#include "tensorflow/contrib/tensorrt/segment/segment.h"
-#include "tensorflow/c/c_api.h"
-#include "tensorflow/core/framework/graph.pb.h"
+
+#include "tensorflow/cc/framework/scope.h"
+#include "tensorflow/cc/ops/standard_ops.h"
+#include "tensorflow/core/graph/testlib.h"
#include "tensorflow/core/lib/core/errors.h"
#include "tensorflow/core/lib/core/status.h"
+#include "tensorflow/core/lib/core/status_test_util.h"
+#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/test.h"
#include "tensorflow/core/platform/types.h"
+#include "tensorflow/core/public/session.h"
namespace tensorflow {
namespace tensorrt {
namespace segment {
namespace test {
+namespace ops = ::tensorflow::ops;
class SegmentTest : public ::testing::Test {
- public:
- bool GetGraphDef(TF_Graph* graph, tensorflow::GraphDef* graph_def);
-
- TF_Operation* Placeholder(TF_Graph* graph, TF_Status* s, const char* name);
- TF_Operation* Add(TF_Operation* l, TF_Operation* r, TF_Graph* graph,
- TF_Status* s, const char* name);
-
+ protected:
std::function