Skip to content
Closed

R1.1 #10626

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
414 changes: 414 additions & 0 deletions tensorflow/docs_src/performance/benchmarks.md

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions tensorflow/docs_src/performance/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@

Performance is often a significant issue when training a machine learning
model. This section explains various ways to optimize performance. Start
your investigation with the following guide:
your investigation with the @{$performance_guide$Performance Guide} and then go
deeper with techniques detailed in @{$performance_models$High-Performance Models}:

* @{$performance_guide$Performance}, which contains a collection of best
* @{$performance_guide$Performance Guide}, which contains a collection of best
practices for optimizing your TensorFlow code.

* @{$performance_models$High-Performance Models}, which contains a collection
of advanced techniques to build highly scalable models targeting different
system types and network topologies.

* @{$benchmarks$Benchmarks}, which contains a collection of benchmark
results.

XLA (Accelerated Linear Algebra) is an experimental compiler for linear
algebra that optimizes TensorFlow computations. The following guides explore
XLA:
Expand Down
5 changes: 4 additions & 1 deletion tensorflow/docs_src/performance/leftnav_files
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
performance_guide.md
performance_models.md
benchmarks.md
quantization.md
>>>
xla/index.md
xla/broadcasting.md
xla/developing_new_backend.md
xla/jit.md
xla/operation_semantics.md
xla/shapes.md
xla/tfcompile.md
quantization.md
9 changes: 6 additions & 3 deletions tensorflow/docs_src/performance/performance_guide.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Performance
# Performance Guide

This guide contains a collection of best practices for optimizing your
TensorFlow code. The best practices apply to both new and experienced
Tensorflow users.
Tensorflow users. As a complement to the best practices in this document, the
@{$performance_models$High-Performance Models} document links to example code
and details for creating models that scale on a variety of hardware.

## Best Practices
While optimizing implementations of different types of models can be different,
Expand Down Expand Up @@ -73,7 +75,7 @@ Unless for a special circumstance or for example code, do not feed data
into the session from Python variables, e.g. `dictionary`.

```python
# This will result in poor performance.
# Using feed_dict often results in suboptimal performance when using large inputs.
sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys})
```

Expand Down Expand Up @@ -141,3 +143,4 @@ bn = tf.contrib.layers.batch_norm(
The non-fused batch norm does computations using several individual Ops. Fused
batch norm combines the individual operations into a single kernel, which runs
faster.

422 changes: 422 additions & 0 deletions tensorflow/docs_src/performance/performance_models.md

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions tensorflow/examples/tutorials/estimators/abalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,22 @@ def main(unused_argv):

# Instantiate Estimator
nn = tf.contrib.learn.Estimator(model_fn=model_fn, params=model_params)


def get_train_inputs():
x = tf.constant(training_set.data)
y = tf.constant(training_set.target)
return x, y

# Fit
nn.fit(x=training_set.data, y=training_set.target, steps=5000)
nn.fit(input_fn=get_train_inputs, steps=5000)

# Score accuracy
ev = nn.evaluate(x=test_set.data, y=test_set.target, steps=1)
def get_test_inputs():
x = tf.constant(test_set.data)
y = tf.constant(test_set.target)
return x, y

ev = nn.evaluate(input_fn=get_test_inputs, steps=1)
print("Loss: %s" % ev["loss"])
print("Root Mean Squared Error: %s" % ev["rmse"])

Expand Down
2 changes: 1 addition & 1 deletion tensorflow/python/estimator/export/export_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ClassificationOutput(ExportOutput):
"""

def __init__(self, scores=None, classes=None):
"""Constructor for `ClassifyOutput`.
"""Constructor for `ClassificationOutput`.

Args:
scores: A float `Tensor` giving scores (sometimes but not always
Expand Down
17 changes: 14 additions & 3 deletions tensorflow/python/ops/math_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,27 @@ def abs(x, name=None):
Given a tensor of real numbers `x`, this operation returns a tensor
containing the absolute value of each element in `x`. For example, if x is
an input element and y is an output element, this operation computes
\\\\(y = |x|\\\\).
\\(y = |x|\\).

Given a tensor `x` of complex numbers, this operation returns a tensor of type
`float32` or `float64` that is the absolute value of each element in `x`. All
elements in `x` must be complex numbers of the form \\(a + bj\\). The
absolute value is computed as \\( \sqrt{a^2 + b^2}\\). For example:
```
# tensor 'x' is [[-2.25 + 4.75j], [-3.25 + 5.75j]]
tf.complex_abs(x) ==> [5.25594902, 6.60492229]
```

Args:
x: A `Tensor` or `SparseTensor` of type `float32`, `float64`, `int32`, or
`int64`.
x: A `Tensor` or `SparseTensor` of type `float32`, `float64`, `int32`,
`int64`, `complex64` or `complex128`.
name: A name for the operation (optional).

Returns:
A `Tensor` or `SparseTensor` the same size and type as `x` with absolute
values.
Note, for `complex64` or `complex128' input, the returned `Tensor` will be
of type `float32` or `float64`, respectively.
"""
with ops.name_scope(name, "Abs", [x]) as name:
if isinstance(x, sparse_tensor.SparseTensor):
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/tensorboard/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
<link rel="import" href="dist/tf-tensorboard.html">
</head>
<body>
<tf-tensorboard></tf-tensorboard>
<tf-tensorboard use-hash></tf-tensorboard>
</body>
</html>