platform/upstream/tensorflow.git
7 years agoFix typo in ValueError string.
A. Unique TensorFlower [Tue, 9 Jan 2018 18:41:06 +0000 (10:41 -0800)]
Fix typo in ValueError string.

PiperOrigin-RevId: 181340112

7 years ago[XLA] Run the LLVM verifier after lowering HLO -> LLVM IR.
Justin Lebar [Tue, 9 Jan 2018 18:06:58 +0000 (10:06 -0800)]
[XLA] Run the LLVM verifier after lowering HLO -> LLVM IR.

This way if we generate bad IR, we emit a nice error message, instead of
(probably) crashing somewhere in LLVM.

PiperOrigin-RevId: 181334588

7 years agoExposes runmetadata from tfe in python.
Alexandre Passos [Tue, 9 Jan 2018 15:37:55 +0000 (07:37 -0800)]
Exposes runmetadata from tfe in python.

PiperOrigin-RevId: 181317960

7 years agoDon't pass '-no-canonical-prefixes' when collecting builtin includes.
Ilya Biryukov [Tue, 9 Jan 2018 13:27:43 +0000 (05:27 -0800)]
Don't pass '-no-canonical-prefixes' when collecting builtin includes.

It matches the way bazel's autoconf works and seems to be the right thing to
do.
This change should fix #14380.

PiperOrigin-RevId: 181305871

7 years agoForward-mode automatic differentiation for Tensorflow.
A. Unique TensorFlower [Tue, 9 Jan 2018 11:49:52 +0000 (03:49 -0800)]
Forward-mode automatic differentiation for Tensorflow.

PiperOrigin-RevId: 181297995

7 years ago[XLA:Tool] Fix an error message in the Hlo parser: should report unexpected subattrib...
A. Unique TensorFlower [Tue, 9 Jan 2018 05:45:02 +0000 (21:45 -0800)]
[XLA:Tool] Fix an error message in the Hlo parser: should report unexpected subattribute's location correctly.

PiperOrigin-RevId: 181265992

7 years agoAvoid deadlock by sleeping for a longer duration.
Frank Chen [Tue, 9 Jan 2018 05:11:20 +0000 (21:11 -0800)]
Avoid deadlock by sleeping for a longer duration.

PiperOrigin-RevId: 181263637

7 years agosubtract the task's size from the batch's when removing it.
A. Unique TensorFlower [Tue, 9 Jan 2018 04:53:48 +0000 (20:53 -0800)]
subtract the task's size from the batch's when removing it.

PiperOrigin-RevId: 181262266

7 years agoAutomated g4 rollback of changelist 181243048
A. Unique TensorFlower [Tue, 9 Jan 2018 04:36:13 +0000 (20:36 -0800)]
Automated g4 rollback of changelist 181243048

PiperOrigin-RevId: 181260801

7 years agoFix typo in comment TFE_Execute
Igor Ganichev [Tue, 9 Jan 2018 04:35:21 +0000 (20:35 -0800)]
Fix typo in comment TFE_Execute

PiperOrigin-RevId: 181260751

7 years ago[TF:XLA] Bump open source llvm revision to r321863
Sanjoy Das [Tue, 9 Jan 2018 04:15:33 +0000 (20:15 -0800)]
[TF:XLA] Bump open source llvm revision to r321863

PiperOrigin-RevId: 181259191

7 years ago[TF:XLA] Add while loop invariant code motion
Sanjoy Das [Tue, 9 Jan 2018 03:41:05 +0000 (19:41 -0800)]
[TF:XLA] Add while loop invariant code motion

This new pass extracts out loop invariant computations out of while loops into
their parent computations.

Right now this is enabled only for the CPU backend.

PiperOrigin-RevId: 181256166

7 years ago[XLA] Fix spelling in error message; NFC
Sanjoy Das [Tue, 9 Jan 2018 03:39:41 +0000 (19:39 -0800)]
[XLA] Fix spelling in error message; NFC

PiperOrigin-RevId: 181256065

7 years agoDon't treat PlaceholderWithDefaults as constants.
Skye Wanderman-Milne [Tue, 9 Jan 2018 03:09:47 +0000 (19:09 -0800)]
Don't treat PlaceholderWithDefaults as constants.

Without this, the shape refiner will use the shape of the default, which may
be more precise than the specified shape. This would cause util_test to
fail with the C API enabled.

PiperOrigin-RevId: 181253665

7 years agoMake meta_graph_test.py work with C API enabled.
Skye Wanderman-Milne [Tue, 9 Jan 2018 02:57:44 +0000 (18:57 -0800)]
Make meta_graph_test.py work with C API enabled.

This mainly means changing test_util.assert_meta_graph_protos_equal to
call assert_equal_graph_def instead of comparing the GraphDef protos
using assertEquals, since the NodeDefs are in a different order with
the C API enabled. It also makes assert_equal_graph_def treat inputs
'tensor' and 'tensor:0' as equal (they're both valid).

PiperOrigin-RevId: 181252488

7 years agoIgnore nodes that are going to be swapped when computing max memory usage
Benoit Steiner [Tue, 9 Jan 2018 02:15:51 +0000 (18:15 -0800)]
Ignore nodes that are going to be swapped when computing max memory usage

PiperOrigin-RevId: 181248577

7 years agoGo: Update generated wrapper functions for TensorFlow ops.
A. Unique TensorFlower [Tue, 9 Jan 2018 02:08:47 +0000 (18:08 -0800)]
Go: Update generated wrapper functions for TensorFlow ops.

PiperOrigin-RevId: 181247809

7 years agoFix the threading model of gradient tapes.
Alexandre Passos [Tue, 9 Jan 2018 01:59:58 +0000 (17:59 -0800)]
Fix the threading model of gradient tapes.

The set of tapes needs to be global to enable multithreaded programming
(when it's natural for tensors to cross threads during reduction operations)
but each thread still needs to be able to locally pause recording while
it does gradient-related bookkeeping (like custom gradients or initialization).

Also removes a mutex from the thread-local structure since it's unnecessary
as we're always holding the GIL while calling across the python-c boundary
unless we explicitly release it.

PiperOrigin-RevId: 181246570

7 years ago[XLA] Initial sparse layout support
A. Unique TensorFlower [Tue, 9 Jan 2018 01:36:56 +0000 (17:36 -0800)]
[XLA] Initial sparse layout support

Adds SparseIndexArray and support methods to Literal. SparseIndexArray manages
the array of sparse indices and is exposed by sparse Literals.

Also adds HloSupportChecker classes for CPU and GPU.  This will be run as the
first HloPass during compilation, and verifies that the graph is supported by
the backend.  Currently only verifies shapes, and that the layout is not sparse
since no backend supports sparse layouts yet.

PiperOrigin-RevId: 181244401

7 years ago[TF:XLA] Pass CompileOptions into XlaCompilationCache::Compile.
A. Unique TensorFlower [Tue, 9 Jan 2018 01:23:57 +0000 (17:23 -0800)]
[TF:XLA] Pass CompileOptions into XlaCompilationCache::Compile.

PiperOrigin-RevId: 181243048

7 years agoMaterialize BroadcastGradientArgs by default instead of just doing so in aggressive...
Benoit Steiner [Tue, 9 Jan 2018 01:21:43 +0000 (17:21 -0800)]
Materialize BroadcastGradientArgs by default instead of just doing so in aggressive mode. This ensures that we optimize gradient computations in the presence of variable batch sizes.

PiperOrigin-RevId: 181242749

7 years agoFixes the TF Lite Makefile so that it correctly adds flags to link with the dl
A. Unique TensorFlower [Tue, 9 Jan 2018 00:56:43 +0000 (16:56 -0800)]
Fixes the TF Lite Makefile so that it correctly adds flags to link with the dl
lib on Linux.  This matches the configuration in the contrib/makefile/Makefile.

PiperOrigin-RevId: 181239691

7 years ago[XLA] Add tests for conditionals that return tuples and whose predicate operands...
A. Unique TensorFlower [Tue, 9 Jan 2018 00:38:01 +0000 (16:38 -0800)]
[XLA] Add tests for conditionals that return tuples and whose predicate operands are external parameters.

PiperOrigin-RevId: 181237427

7 years ago[XLA:GPU] Warn if ptxas or the driver JIT has known bugs.
Justin Lebar [Tue, 9 Jan 2018 00:19:30 +0000 (16:19 -0800)]
[XLA:GPU] Warn if ptxas or the driver JIT has known bugs.

We try to compile ptx->sass using ptxas, and fall back to the driver JIT
only if this fails.  So we only warn about a bad driver JIT version if
we actually use the driver to compile our ptx.

This change also quiets a LOG(INFO) to a VLOG(1) in cuda_diagnostics.cc
so we don't spit out the full contents of the driver file when we query
it.

PiperOrigin-RevId: 181235275

7 years agoEnable _warmstart() to work with un-partitioned variables.
A. Unique TensorFlower [Tue, 9 Jan 2018 00:08:44 +0000 (16:08 -0800)]
Enable _warmstart() to work with un-partitioned variables.

PiperOrigin-RevId: 181233898

7 years agograbbing the graph_def from the C API instead of depending on the python graph_def...
Olivia Nordquist [Tue, 9 Jan 2018 00:07:58 +0000 (16:07 -0800)]
grabbing the graph_def from the C API instead of depending on the python graph_def: the C-API had an experimental field that is stripped when empty to match the python implementation.

PiperOrigin-RevId: 181233777

7 years agoFix sample_benchmark target path in documentation.
Anna R [Mon, 8 Jan 2018 23:59:58 +0000 (15:59 -0800)]
Fix sample_benchmark target path in documentation.

PiperOrigin-RevId: 181232554

7 years agoFix bug in template_test's test_nested_templates method.
Akshay Agrawal [Mon, 8 Jan 2018 23:42:33 +0000 (15:42 -0800)]
Fix bug in template_test's test_nested_templates method.

PiperOrigin-RevId: 181230269

7 years agoRemove third_party/ prefixes.
Yifei Feng [Mon, 8 Jan 2018 23:06:59 +0000 (15:06 -0800)]
Remove third_party/ prefixes.
Closes #15674.

PiperOrigin-RevId: 181225180

7 years agoVery minor edits to performance_guide.md
Neal Wu [Mon, 8 Jan 2018 22:59:16 +0000 (14:59 -0800)]
Very minor edits to performance_guide.md

PiperOrigin-RevId: 181223906

7 years agoSupport Transpose in TFLite.
Nupur Garg [Mon, 8 Jan 2018 22:45:31 +0000 (14:45 -0800)]
Support Transpose in TFLite.

The internal implementation supports 1D-4D tensors.

PiperOrigin-RevId: 181221674

7 years agoCore code transformers.
A. Unique TensorFlower [Mon, 8 Jan 2018 22:42:52 +0000 (14:42 -0800)]
Core code transformers.

PiperOrigin-RevId: 181221299

7 years agoDisable all failing tests to fix TF opensource tests.
Gunhan Gulsoy [Mon, 8 Jan 2018 21:45:32 +0000 (13:45 -0800)]
Disable all failing tests to fix TF opensource tests.

PiperOrigin-RevId: 181212111

7 years agotoco: Fix missing check for buffer in ResizeBilinear.
A. Unique TensorFlower [Mon, 8 Jan 2018 21:29:40 +0000 (13:29 -0800)]
toco: Fix missing check for buffer in ResizeBilinear.

PiperOrigin-RevId: 181209975

7 years agoAdd a section about running the benchmarks with python. Also renamed so that https...
Katherine Wu [Mon, 8 Jan 2018 20:47:30 +0000 (12:47 -0800)]
Add a section about running the benchmarks with python. Also renamed so that https://tensorflow.org/community/benchmarks and https://www.tensorflow.org/performance/benchmarks have different titles

PiperOrigin-RevId: 181203841

7 years agoMerged commit includes the following changes:
A. Unique TensorFlower [Mon, 8 Jan 2018 20:45:11 +0000 (12:45 -0800)]
Merged commit includes the following changes:
181203530  by gunan:

    Adding a CLIF library for generic_tree_model.proto

--
181201655  by annarev:

    Internal change.

--
181197493  by akshayka:

    Make benchmark names in eager's resnet50_test unique.

--
181196715  by A. Unique TensorFlower:

    Correct the typo of "ny.arrange" to "ny.arange".

--
181194884  by A. Unique TensorFlower:

    Update ops-related pbtxt files.

--
181193667  by power:

    Avoid reading through the inputbuffer for large reads.

--
181192456  by A. Unique TensorFlower:

    Adding a CLIF library for generic_tree_model.proto

--

PiperOrigin-RevId: 181203530

7 years agoUse suffix instead of prefix for nodes added by layout optimizer so that
Yao Zhang [Mon, 8 Jan 2018 19:26:11 +0000 (11:26 -0800)]
Use suffix instead of prefix for nodes added by layout optimizer so that
tensorboard graph organization is preserved.

PiperOrigin-RevId: 181192261

7 years agotypo
Mark Daoust [Mon, 8 Jan 2018 18:46:13 +0000 (10:46 -0800)]
typo

PiperOrigin-RevId: 181185642

7 years agoSmall changes to tf.contrib.receptive_field, in order to
A. Unique TensorFlower [Mon, 8 Jan 2018 18:43:47 +0000 (10:43 -0800)]
Small changes to tf.contrib.receptive_field, in order to
1) handle control-dependency input nodes.
2) handle a few more types of operations.

The new functionality is tested by a unit test.

PiperOrigin-RevId: 181185267

7 years agotfdbg: Add DebugGradientRefIdentity op
Shanqing Cai [Mon, 8 Jan 2018 17:27:21 +0000 (09:27 -0800)]
tfdbg: Add DebugGradientRefIdentity op

Previously, the gradients debugger used DebugGradientIdentity regardless of
whether the input tensor is a reference type or non-reference type. This CL
switches it to a more specific DebugGradientRefIdentity type for reference
type tensors. This ensures that the output of the debug-identity op matches
its input exactly.

DebugGradientIdentity continues to be used for non-reference type tensors.

PiperOrigin-RevId: 181174976

7 years agominor fixes to new "low_level_intro"
Mark Daoust [Mon, 8 Jan 2018 17:04:58 +0000 (09:04 -0800)]
minor fixes to new "low_level_intro"

PiperOrigin-RevId: 181172455

7 years agoClarify documentation for squeeze_spatial. Use of squeeze_spatial=True with large...
A. Unique TensorFlower [Sun, 7 Jan 2018 11:06:06 +0000 (03:06 -0800)]
Clarify documentation for squeeze_spatial. Use of squeeze_spatial=True with large images results in an error, either at graph build time (if the input image size is known), or at runtime (if not).

Example error message (for the former case):
ValueError: Can not squeeze dim[1], expected a dimension of 1, got 7 for 'InceptionV3/AuxLogits/SpatialSqueeze' (op: 'Squeeze') with input shapes: [1,7,7,1001].
PiperOrigin-RevId: 181075862

7 years agoCorrectly connect control dependencies to switch nodes when doing arithmetic
Benoit Steiner [Sat, 6 Jan 2018 17:51:38 +0000 (09:51 -0800)]
Correctly connect control dependencies to switch nodes when doing arithmetic
simplifications

PiperOrigin-RevId: 181043095

7 years agoAdd bazel file for astor, gast and termcolor. Rewrite these deps' internal counterpar...
A. Unique TensorFlower [Sat, 6 Jan 2018 13:34:03 +0000 (05:34 -0800)]
Add bazel file for astor, gast and termcolor. Rewrite these deps' internal counterparts instead of removing them. Re-enable a few tests to verify.

PiperOrigin-RevId: 181035075

7 years agoMake images larger
Mark Daoust [Sat, 6 Jan 2018 13:06:20 +0000 (05:06 -0800)]
Make images larger

PiperOrigin-RevId: 181034398

7 years agoRemove protobuf-compatibility methods from the Literal class.
Mark Heffernan [Sat, 6 Jan 2018 05:46:44 +0000 (21:46 -0800)]
Remove protobuf-compatibility methods from the Literal class.

This CL primarily does two things:

 (1) Remove the protobuf-compatibility methods (eg, mutable_f32s()) from Literal. These were added to Literal as part of the migration of Literal from a proto to a c++ class. Now that Literal is a proper class, these protobuf methods make it difficult to enforce invariants and expose too much of the class' implementation details.

 (2) Make shape an immutable property of Literals, and make shape and the data members holding the Literal data coherent by construction. Previously, the shape could be set arbitrarily, and the data members such as f32_ could be arbitrarily sized irrespective of the shape of the literal.

The remainder of the CL mostly deals with the fallout. Notable other changes:

- Literal is no longer a recursive data structure. To avoid copies when passing a subliteral of a tuple-shaped Literal, a LiteralView class is added which provides a read-only view of an arbitrary subliteral.

- Tuple-shaped Literals can no longer be built up incrementally so to avoid copying Literal values during construction, the following methods with move semantics are added: Literal::MoveFrom and Literal::MoveIntoTuple. These methods transfer ownership the underlying buffers enabling, for example, a literal to be moved into an element of a tuple-shaped literal with no data copying.

- Replace the internal data structure holding the actual data from a bunch of std::vectors (eg, s32s_, f32s, etc) to a single ShapeTree<char*>. This significantly simplifies accessors and makes improved support of tuple-shaped literals much easier (eg, Literal::Get<>() can now access elements in arbitrary subliterals).

Also, Literal is made movable, but not copyable. Otherwise, it is all too easy to accidentally introduce expensive copies of Literals. Literal::Clone is added to handle the case where a copy is needed (Literal::CloneToUnique already exists).

PiperOrigin-RevId: 181014890

7 years agoAdd `FunctionLibraryRuntime::InstantiateOptions` struct (take 2).
Derek Murray [Sat, 6 Jan 2018 02:45:12 +0000 (18:45 -0800)]
Add `FunctionLibraryRuntime::InstantiateOptions` struct (take 2).

This new struct allows optional arguments to be passed to the
`FunctionLibraryRuntime::Instantiate()` API. The new struct is now
used to configure the target device for a function instantiation
(instead of an attr).

This version fixes an issue in the previous attempt whereby identical
functions instantiated on different devices in the same task would be
canonicalized to the same key and hence receive the same handle in the
ProcFLR, but they would only be instantiated locally in one per-device
FLR. The fix ensures that the device name is part of the canonicalized
form. A test is added to function_test.py that failed with the old
version and passed in the new version.
END_PUBLIC

BEGIN_PUBLIC
Automated g4 rollback of changelist 180979141

PiperOrigin-RevId: 181003413

7 years agoMeasure memory for restore subgraph in SaveRestoreMeasuringCoseEstimator.
Yuefeng Zhou [Sat, 6 Jan 2018 02:43:41 +0000 (18:43 -0800)]
Measure memory for restore subgraph in SaveRestoreMeasuringCoseEstimator.

PiperOrigin-RevId: 181003320

7 years agoMake CUDNN RNN compatible with eager execution's kernel caching.
Allen Lavoie [Sat, 6 Jan 2018 01:53:39 +0000 (17:53 -0800)]
Make CUDNN RNN compatible with eager execution's kernel caching.

Allows multiple CUDNN RNN calls with different shapes to share the same kernel.

Adds an input_shape-keyed scratch space cache to the kernel. This also fixes shape errors when a CUDNN RNN kernel was presented with multiple shapes during graph execution (e.g. from a while_loop).

Fixes #15752.

PiperOrigin-RevId: 180998667

7 years ago * Make fake argument generation see through ReducePrecision and Convert ops when
Bjarke Hammersholt Roune [Sat, 6 Jan 2018 00:56:14 +0000 (16:56 -0800)]
 * Make fake argument generation see through ReducePrecision and Convert ops when
     determining constraints.
 * Generate both positive and negative numbers as a work-around for the CPU reduce
     implementation having poor numerical stability.
 * You can now VLOG hlo_runner to see the results.

PiperOrigin-RevId: 180993147

7 years agoSupport reduction along axis NHW, HW, and C. One use case of "along NHW" is (unfused...
Yao Zhang [Sat, 6 Jan 2018 00:35:41 +0000 (16:35 -0800)]
Support reduction along axis NHW, HW, and C. One use case of "along NHW" is (unfused) batch norm. Minor code simplification for squeeze, as added transpose node has shape info now.

PiperOrigin-RevId: 180991050

7 years agoImproved the shape inference for TensorArrayGradV3
Benoit Steiner [Sat, 6 Jan 2018 00:20:20 +0000 (16:20 -0800)]
Improved the shape inference for TensorArrayGradV3

PiperOrigin-RevId: 180989529

7 years agoMake compute_output_shape public in masked core layers
A. Unique TensorFlower [Sat, 6 Jan 2018 00:09:47 +0000 (16:09 -0800)]
Make compute_output_shape public in masked core layers

PiperOrigin-RevId: 180988293

7 years agoProperly set the type of the swap nodes.
Benoit Steiner [Fri, 5 Jan 2018 23:49:41 +0000 (15:49 -0800)]
Properly set the type of the swap nodes.

PiperOrigin-RevId: 180985878

7 years agoDoes not use constants for zeros/ones.
Alexandre Passos [Fri, 5 Jan 2018 23:12:01 +0000 (15:12 -0800)]
Does not use constants for zeros/ones.

PiperOrigin-RevId: 180981378

7 years agoFixed fused batch norm performance regression.
Reed Wanderman-Milne [Fri, 5 Jan 2018 23:07:51 +0000 (15:07 -0800)]
Fixed fused batch norm performance regression.

The regression was caused by 12a4c9b8628b23cc2bf4c89c83c32760aded6124. I suspect the regression was caused by calling cudaMemset without setting the CUDA stream. Using the SetZeroFunctor (or using Eigen) handles this type of initialization for us.

Benchmarks on tf_cnn_benchmarks, on a Volta DGX1, average of 3 iterations taken, with arguments: --optimizer=sgd --staged_vars=False --num_gpus=$GPU --variable_update=$VAR_UPDATE --use_fp16=True --batch_size=128 --model=$MODEL

model       gpu  var_update        im/sec after  im/sec before  percent diff
resnet50    1    replicated        680.37333     640.10333      6.29117%
resnet50    8    parameter_server  4046.04000    1282.28667     215.53319%
resnet50    8    replicated        4157.30667    1634.22667     154.38984%
inception3  1    replicated        463.88667     440.94333      5.20324%
inception3  8    parameter_server  2655.55000    902.22333      194.33400%
inception3  8    replicated        3034.81000    1033.43667     193.66192%

PiperOrigin-RevId: 180980799

7 years agoMinor bug fix in PrefetchDataset state saving/restoring.
Saurabh Saxena [Fri, 5 Jan 2018 23:04:53 +0000 (15:04 -0800)]
Minor bug fix in PrefetchDataset state saving/restoring.

PiperOrigin-RevId: 180980476

7 years agoAutomated g4 rollback of changelist 180848930
James Qin [Fri, 5 Jan 2018 22:55:24 +0000 (14:55 -0800)]
Automated g4 rollback of changelist 180848930

PiperOrigin-RevId: 180979141

7 years agoFix typo in the docstring of `make_template`.
Akshay Agrawal [Fri, 5 Jan 2018 22:51:31 +0000 (14:51 -0800)]
Fix typo in the docstring of `make_template`.

PiperOrigin-RevId: 180978665

7 years agoFixed bad logging in iOS app tflite_simple_example.
A. Unique TensorFlower [Fri, 5 Jan 2018 22:47:01 +0000 (14:47 -0800)]
Fixed bad logging in iOS app tflite_simple_example.

PiperOrigin-RevId: 180978115

7 years agoAdd a mutex around the tfe context kernel_cache.
Alexandre Passos [Fri, 5 Jan 2018 22:40:18 +0000 (14:40 -0800)]
Add a mutex around the tfe context kernel_cache.

PiperOrigin-RevId: 180977309

7 years agoOutput variance over tree predictions for classifications.
A. Unique TensorFlower [Fri, 5 Jan 2018 22:32:31 +0000 (14:32 -0800)]
Output variance over tree predictions for classifications.

PiperOrigin-RevId: 180976319

7 years agoAdd a FlushFileSystemCaches method to Env, for flushing caches of all registered...
A. Unique TensorFlower [Fri, 5 Jan 2018 22:26:11 +0000 (14:26 -0800)]
Add a FlushFileSystemCaches method to Env, for flushing caches of all registered filesystems.

PiperOrigin-RevId: 180975443

7 years agoDon't swap out inputs that expect a reference.
Benoit Steiner [Fri, 5 Jan 2018 22:23:59 +0000 (14:23 -0800)]
Don't swap out inputs that expect a reference.

PiperOrigin-RevId: 180975132

7 years agoMove some build configs to tools/bazel.rc from configure.py
Michael Case [Fri, 5 Jan 2018 22:09:41 +0000 (14:09 -0800)]
Move some build configs to tools/bazel.rc from configure.py

Moving --config=android_arm --config=mkl and --config=monolithic
build configs into tools/bazel.rc. These options are just always
written the same way to .bazelrc when configure.py is run. This
should trim down the scope of configure.py and make it easier to
build TF without running configure.py prior.

PiperOrigin-RevId: 180973131

7 years agoImplemented memory swapping heuristics for GPU
Benoit Steiner [Fri, 5 Jan 2018 21:35:03 +0000 (13:35 -0800)]
Implemented memory swapping heuristics for GPU

PiperOrigin-RevId: 180968225

7 years agoBasic templating code.
A. Unique TensorFlower [Fri, 5 Jan 2018 20:58:00 +0000 (12:58 -0800)]
Basic templating code.

PiperOrigin-RevId: 180964100

7 years agoChange placeholder exception to log instead of throwing an exception.
Russell Power [Fri, 5 Jan 2018 20:51:39 +0000 (12:51 -0800)]
Change placeholder exception to log instead of throwing an exception.

It is difficult to remove placeholders from existing meta-graphs without breaking other structures.  As long as the placeholders do not contribute towards the loss/evaluation function they are harmless.

PiperOrigin-RevId: 180963420

7 years agoClear eager kernel cache when resetting random seed.
Alexandre Passos [Fri, 5 Jan 2018 20:38:20 +0000 (12:38 -0800)]
Clear eager kernel cache when resetting random seed.

"big hammer" required for reproducibility.

PiperOrigin-RevId: 180961787

7 years agoChange int64 to int64_t to support 64-bit compilation
Austin Anderson [Fri, 5 Jan 2018 20:02:27 +0000 (12:02 -0800)]
Change int64 to int64_t to support 64-bit compilation

PiperOrigin-RevId: 180957437

7 years agoEdit the macros to avoid trying to output stacktraces on mobile platforms.
Gunhan Gulsoy [Fri, 5 Jan 2018 19:54:42 +0000 (11:54 -0800)]
Edit the macros to avoid trying to output stacktraces on mobile platforms.

PiperOrigin-RevId: 180956594

7 years agoTemporarily disable tests until we can run them in opensource build.
A. Unique TensorFlower [Fri, 5 Jan 2018 19:45:30 +0000 (11:45 -0800)]
Temporarily disable tests until we can run them in opensource build.

PiperOrigin-RevId: 180955394

7 years agoMake it possible to wrap Layer's `call` method in `tfe.defun`.
Akshay Agrawal [Fri, 5 Jan 2018 19:41:07 +0000 (11:41 -0800)]
Make it possible to wrap Layer's `call` method in `tfe.defun`.

This change:
  (1) wraps Layer's `build` method in an `init_scope`, which in turn makes it
      possible to compile the `call` method into a graph function by wrapping
      it in `tfe.defun` because the `init_scope` lifts all ops created in
      `build` out of function-building graphs;

  (2) defers the creation of regularizers, constructing them after `build`
      exits and thereby ensuring that they are not created inside an
      `init_scope`.

PiperOrigin-RevId: 180954866

7 years agoIntroduces back a faster specialization of the unique op for cases where uniqueness...
A. Unique TensorFlower [Fri, 5 Jan 2018 19:13:07 +0000 (11:13 -0800)]
Introduces back a faster specialization of the unique op for cases where uniqueness is applied on single elements. This produces up to 3x performance improvements in the microbenchmark, which was lost when support was added for UniqueV2.

PiperOrigin-RevId: 180951153

7 years agoInternal changes to stacktrace handling.
Yusef Shafi [Fri, 5 Jan 2018 18:59:00 +0000 (10:59 -0800)]
Internal changes to stacktrace handling.

PiperOrigin-RevId: 180949246

7 years ago[TF:XLA] Correctly simplify while loops with a non-tuple root body
Sanjoy Das [Fri, 5 Jan 2018 18:55:27 +0000 (10:55 -0800)]
[TF:XLA] Correctly simplify while loops with a non-tuple root body

Explicitly bail out if the root instruction of a loop body isn't a tuple()
instruction.

PiperOrigin-RevId: 180948724

7 years agoAdded a couple of trivial tests
Benoit Steiner [Fri, 5 Jan 2018 17:58:08 +0000 (09:58 -0800)]
Added a couple of trivial tests

PiperOrigin-RevId: 180940645

7 years agoSupport reduction in NWC dimension. One use case of this is layer
Yao Zhang [Fri, 5 Jan 2018 17:39:45 +0000 (09:39 -0800)]
Support reduction in NWC dimension. One use case of this is layer
normalization.

PiperOrigin-RevId: 180938381

7 years agoFix typo in dataset performance guide
Brennan Saeta [Fri, 5 Jan 2018 17:31:50 +0000 (09:31 -0800)]
Fix typo in dataset performance guide

PiperOrigin-RevId: 180937467

7 years agoTests contrib.signal.stft with XLA compilation.
Brian Patton [Fri, 5 Jan 2018 16:59:26 +0000 (08:59 -0800)]
Tests contrib.signal.stft with XLA compilation.

PiperOrigin-RevId: 180933803

7 years agoMake SQLite veneer better
Justine Tunney [Fri, 5 Jan 2018 08:46:32 +0000 (00:46 -0800)]
Make SQLite veneer better

This iteration does a very good job following the contracts of the
actual API. Smart pointers ensure objects are destroyed in the correct
order. RAII locking and transactions are now possible, with Clang
thread safety analysis. Tuning is now done with environment variables.

PiperOrigin-RevId: 180897579

7 years agoAdd ability to dump stacktraces, and enable auto stacktrace generation to cpp
Gunhan Gulsoy [Fri, 5 Jan 2018 06:13:05 +0000 (22:13 -0800)]
Add ability to dump stacktraces, and enable auto stacktrace generation to cpp
tests.

PiperOrigin-RevId: 180889511

7 years agoAdd MNIST GAN example and benchmarks
Igor Ganichev [Fri, 5 Jan 2018 05:00:08 +0000 (21:00 -0800)]
Add MNIST GAN example and benchmarks

Training benchmark results on GPU:
batch_size                           64   128    256
training eager rate                2640  5330   7269
training graph rate                5340  7080   8380
traning eager/graph                 0.5  0.75   0.86
generating eager rate             45872 86192 142009
generating graph rate             63558 85610 104939
generating eager/graph             0.72   1.0   1.35

rate is processed/generated mnist images per second.

Eager is faster when generating because we don't need to copy "feeds"
from CPU to GPU memory.

PiperOrigin-RevId: 180885299

7 years agoRefactoring and bug-fixes for _build_initializer_expr.
A. Unique TensorFlower [Fri, 5 Jan 2018 02:53:50 +0000 (18:53 -0800)]
Refactoring and bug-fixes for _build_initializer_expr.

- Rename _build_initializer_expr to _try_guard_against_uninitialized_dependencies so as to clarify what it does.

- Avoid invoking the logic in _try_guard_against_uninitialized_dependencies for cyclic graphs. This currently results in infinite recursion which blows the stack.

- Use memoization to reduce the number of redundant operations created by _try_guard_against_uninitialized_dependencies when it encounters initial values with diamond-shaped dependencies.

- Refactoring: Remove unnecessary logic in _try_guard_against_uninitialized_dependencies for dealing with types other than Tensor or Operation. The dependency graph of a Variable's _initial_value should only ever comprise these two types.

- Refactoring: Added some filtering logic to _try_guard_against_uninitialized_dependencies to avoid initial_values with cyclic dependencies

- Refactoring: Moved the recursive traversal of initial_value`s dependencies into _safe_initial_value_from_tensor and _safe_initial_value_from_op.

- Refactoring: Made it so _find_initialized_value_for_variable will return None when it can't find the initialized_value. Currently it returns a Tensor when it finds the initialized_value and an Operation when it can't. This makes the logic in the caller a bit more consistent and explicit.

Future changes will address more of the shortcomings of _build_initializer_expr.

PiperOrigin-RevId: 180876754

7 years ago[XLA] Doc change: the invariant that GetBufferAlias is always non-empty no longer...
A. Unique TensorFlower [Fri, 5 Jan 2018 02:39:51 +0000 (18:39 -0800)]
[XLA] Doc change: the invariant that GetBufferAlias is always non-empty no longer holds.

With in-place slices, we can have:
X = slice(Y)
Where the buffer for Y has aliases {X, Y}, and the buffer for X has no aliases.
PiperOrigin-RevId: 180875794

7 years agoAdd a FlushCaches() method to the FileSystem interface, and provide an implementation...
A. Unique TensorFlower [Fri, 5 Jan 2018 02:17:49 +0000 (18:17 -0800)]
Add a FlushCaches() method to the FileSystem interface, and provide an implementation for GcsFileSystem.

PiperOrigin-RevId: 180873963

7 years agoMake HLO device placer more stable as far as created partitions goes.
A. Unique TensorFlower [Fri, 5 Jan 2018 01:57:23 +0000 (17:57 -0800)]
Make HLO device placer more stable as far as created partitions goes.
Also remove the multi-module input capability for the device placer.

PiperOrigin-RevId: 180871703

7 years ago[XLA] Expose replicas via local client API.
Chris Leary [Fri, 5 Jan 2018 01:20:45 +0000 (17:20 -0800)]
[XLA] Expose replicas via local client API.

PiperOrigin-RevId: 180868190

7 years agoAdd user friendly debugging message to TOCO.
A. Unique TensorFlower [Fri, 5 Jan 2018 00:35:44 +0000 (16:35 -0800)]
Add user friendly debugging message to TOCO.

PiperOrigin-RevId: 180863083

7 years ago[TFXLA] Handle control edges to cond not dominated.
Jacques Pienaar [Fri, 5 Jan 2018 00:32:00 +0000 (16:32 -0800)]
[TFXLA] Handle control edges to cond not dominated.

Graphs may have control dependency from outside the cond construct that
do not enter via a switch. If there is a control edge from outside then change
the edge to be a control edge onto the inserted XlaIf op instead and remove the
original control edge.

PiperOrigin-RevId: 180862658

7 years agoAdds a test exercising Atan2 via XLA client.
Brian Patton [Fri, 5 Jan 2018 00:27:23 +0000 (16:27 -0800)]
Adds a test exercising Atan2 via XLA client.

PiperOrigin-RevId: 180862094

7 years agoInclude the main TensorFlow eager header file in the binary distribution.
A. Unique TensorFlower [Fri, 5 Jan 2018 00:14:33 +0000 (16:14 -0800)]
Include the main TensorFlow eager header file in the binary distribution.

PiperOrigin-RevId: 180860461

7 years agoJava: Instructions for using GPUs via Maven.
Asim Shankar [Fri, 5 Jan 2018 00:07:05 +0000 (16:07 -0800)]
Java: Instructions for using GPUs via Maven.

GPU support in Maven is being packaged with 1.5.0-rc0 onwards
(for Linux)

Fixes #12909

PiperOrigin-RevId: 180859336

7 years agoBump the size of interleave_dataset_op_test to avoid flaky timeouts.
Gunhan Gulsoy [Thu, 4 Jan 2018 23:50:24 +0000 (15:50 -0800)]
Bump the size of interleave_dataset_op_test to avoid flaky timeouts.

PiperOrigin-RevId: 180856860

7 years agoAddresses the bug that when a grpc session is created and immediately closed, an...
Olivia Nordquist [Thu, 4 Jan 2018 23:48:10 +0000 (15:48 -0800)]
Addresses the bug that when a grpc session is created and immediately closed, an error was returned because the handle_ was still empty.  Now, it just returns Status::OK()

PiperOrigin-RevId: 180856560

7 years ago[XLA] Slightly improve a CHECK-fail message.
A. Unique TensorFlower [Thu, 4 Jan 2018 23:39:50 +0000 (15:39 -0800)]
[XLA] Slightly improve a CHECK-fail message.

PiperOrigin-RevId: 180855522

7 years agoMinimal static analysis. Resolves variable visibility and type information.
A. Unique TensorFlower [Thu, 4 Jan 2018 23:32:36 +0000 (15:32 -0800)]
Minimal static analysis. Resolves variable visibility and type information.

PiperOrigin-RevId: 180854642

7 years agoMake layer method `compute_output_shape` public.
Francois Chollet [Thu, 4 Jan 2018 23:28:49 +0000 (15:28 -0800)]
Make layer method `compute_output_shape` public.

Motivations:
- Useful for computing the shape of a layer's output without calling the layer.
- It is public in standalone keras (hence API discrepancy, which is something to be avoided).
- With eager mode and deferred mode for Network building, it is going to be increasingly necessary for users to implement this method or call it.
- Lots of internal users are apparently already relying on it, which highlights the importance of making this feature publicly available.
PiperOrigin-RevId: 180854139

7 years ago[tf.data] Add benchmarks for variants of slice/batch/repeat pipelines.
Derek Murray [Thu, 4 Jan 2018 23:26:58 +0000 (15:26 -0800)]
[tf.data] Add benchmarks for variants of slice/batch/repeat pipelines.

These pipelines are typically very simple, and magnify the effect of
TensorFlow and `tf.data` overheads. Tracking them continuously will
help to evaluate performance improvements, with a view to addressing
issue #15694.

Representative measurements from my workstation:

tensorflow/python/data/kernel_tests/dataset_constructor_op_test.py:

* Dataset.from_tensor_slices().repeat().batch() with Session.run(): 155 ms/element
* Dataset.from_tensor_slices().repeat().batch() with Session.make_callable(): 91 ms/element
* Dataset.from_tensor_slices(numpy.reshape(.)).repeat() with Session.make_callable(): 44 ms/element
* Dataset.from_tensor_slices().batch().cache().repeat() with Session.make_callable(): 43 ms/element

tensorflow/contrib/eager/python/datasets_test.py:

* Dataset.from_tensor_slices().repeat().batch() with tfe.Iterator(): 102 ms/element
* Dataset.from_tensor_slices().batch().cache().repeat() with tfe.Iterator(): 53 ms/element

PiperOrigin-RevId: 180853890

7 years agoMake 403 errors due to GCS more verbose.
A. Unique TensorFlower [Thu, 4 Jan 2018 23:23:23 +0000 (15:23 -0800)]
Make 403 errors due to GCS more verbose.

The current GCS client code neglects to print the nature of a 403 error. For
example, a 403 error can occur because of permissions or rate limiting. The
nature of a 403 error is communicated through the HTTP response. Thus, this
patch extends the 403 error message with the HTTP response returned by curl.

As an example, a 403 error looked like this before this patch:
PermissionDeniedError: Error executing an HTTP request (HTTP response code 403, error code 0, error message '')

With this patch, it might look like:
PermissionDeniedError: Error executing an HTTP request (HTTP response code 403, error code 0, error message ''), response {
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "userRateLimitExceeded",
    "message": "User Rate Limit Exceeded"
   }
  ],
  "code": 403,
  "message": "User Rate Limit Exceeded"
 }
}
PiperOrigin-RevId: 180853399