platform/upstream/tensorflow.git
6 years agoRemove unnecessary dependency from xla:types
Todd Wang [Tue, 30 Jan 2018 22:06:07 +0000 (14:06 -0800)]
Remove unnecessary dependency from xla:types

PiperOrigin-RevId: 183888495

6 years agoAdd and Mul support broadcasting.
A. Unique TensorFlower [Tue, 30 Jan 2018 21:58:05 +0000 (13:58 -0800)]
Add and Mul support broadcasting.

PiperOrigin-RevId: 183886920

6 years ago[tf.data] Add `IteratorContext::allocator()`.
Derek Murray [Tue, 30 Jan 2018 21:26:51 +0000 (13:26 -0800)]
[tf.data] Add `IteratorContext::allocator()`.

This enables the various iterator implementations to use the actual allocator for the device on which they are running, rather than defaulting to `cpu_allocator()` (which is typically a plain malloc). In future, this will enable allocating iterator outputs in CUDA-pinned memory (and GPU memory).

PERFORMANCE NOTE: In sessions where `ConfigProto.force_gpu_compatible == True`, this change has the effect of allocating all input pipeline tensors in CUDA-pinned memory. Previous if this flag was set, only the tensors allocated during function execution would be allocated in this space, and other tensors (e.g. the result of a `Dataset.batch()` would be allocated using `cpu_allocator()` (i.e. `malloc()`). This change should lead to more efficient communication between a host-side input pipeline and GPUs, but it may also create more pressure on the CUDA host allocator (whose default maximum size is 64GB). The "TF_CUDA_HOST_MEM_LIMIT_IN_MB" environment variable can be used to override this value.

This change is a starting point for working on issue #13610.

PiperOrigin-RevId: 183881907

6 years agoEager: Update documentation to reflect that you can use TensorFlow 1.5
Asim Shankar [Tue, 30 Jan 2018 21:20:13 +0000 (13:20 -0800)]
Eager: Update documentation to reflect that you can use TensorFlow 1.5

PiperOrigin-RevId: 183880991

6 years agoAdd missing dependency.
A. Unique TensorFlower [Tue, 30 Jan 2018 21:10:54 +0000 (13:10 -0800)]
Add missing dependency.

PiperOrigin-RevId: 183879566

6 years agoEnable bulk restoration by default.
Russell Power [Tue, 30 Jan 2018 21:02:25 +0000 (13:02 -0800)]
Enable bulk restoration by default.

This enables loading multiple tensors in single call, allowing for better buffering and reduced load on distributed filesystems.

PiperOrigin-RevId: 183878169

6 years agoSupport outfeed host calls in TPUEstimator. That implicitly allows us to support...
Jonathan Hseu [Tue, 30 Jan 2018 20:49:18 +0000 (12:49 -0800)]
Support outfeed host calls in TPUEstimator. That implicitly allows us to support tf.contrib.summary (see the unit test).

We may change the recommended way to use summaries later.

PiperOrigin-RevId: 183876356

6 years agoAutomated g4 rollback of changelist 183846994
A. Unique TensorFlower [Tue, 30 Jan 2018 20:36:51 +0000 (12:36 -0800)]
Automated g4 rollback of changelist 183846994

PiperOrigin-RevId: 183874527

6 years agoFix bad logging call in warmstarting_utils.py.
Martin Wicke [Tue, 30 Jan 2018 20:32:30 +0000 (12:32 -0800)]
Fix bad logging call in warmstarting_utils.py.

PiperOrigin-RevId: 183873925

6 years agoAdd check macro for not-equal.
A. Unique TensorFlower [Tue, 30 Jan 2018 20:13:58 +0000 (12:13 -0800)]
Add check macro for not-equal.

PiperOrigin-RevId: 183871336

6 years agoEliminate crash on a 'no error' return from DecodeGif when parsing an invalid
David G. Andersen [Tue, 30 Jan 2018 20:06:40 +0000 (12:06 -0800)]
Eliminate crash on a 'no error' return from DecodeGif when parsing an invalid
gif.  (Previous code tried to strcat a null).

PiperOrigin-RevId: 183870288

6 years agoRetryingFileSystem::FlushCaches() calls the base FileSystem's FlushCaches().
A. Unique TensorFlower [Tue, 30 Jan 2018 20:01:02 +0000 (12:01 -0800)]
RetryingFileSystem::FlushCaches() calls the base FileSystem's FlushCaches().

PiperOrigin-RevId: 183869325

6 years agoAdd static_sample flag to Mixture, permitting calls to `sample` to not rely on dynami...
A. Unique TensorFlower [Tue, 30 Jan 2018 20:00:04 +0000 (12:00 -0800)]
Add static_sample flag to Mixture, permitting calls to `sample` to not rely on dynamic tensor indexing. This allows for some static graph compilation optimizations, but at the expense of sampling all underlying distributions in the mixture.

PiperOrigin-RevId: 183869189

6 years ago[TF:XLA] Bump open source llvm revision to r323761
Sanjoy Das [Tue, 30 Jan 2018 19:53:26 +0000 (11:53 -0800)]
[TF:XLA] Bump open source llvm revision to r323761

PiperOrigin-RevId: 183868087

6 years agoK-FAC: expose set_global_constants() for tf.contrib.kfac.utils
A. Unique TensorFlower [Tue, 30 Jan 2018 19:47:43 +0000 (11:47 -0800)]
K-FAC: expose set_global_constants() for tf.contrib.kfac.utils
PiperOrigin-RevId: 183867014

6 years agoDelete dead code in Layer.
Akshay Agrawal [Tue, 30 Jan 2018 19:42:31 +0000 (11:42 -0800)]
Delete dead code in Layer.

PiperOrigin-RevId: 183866106

6 years ago[XLA] Fix tools broken by cl/183837856
Chris Leary [Tue, 30 Jan 2018 19:22:12 +0000 (11:22 -0800)]
[XLA] Fix tools broken by cl/183837856

PiperOrigin-RevId: 183862522

6 years agoMake loss_ops_test.py work with C API enabled.
Skye Wanderman-Milne [Tue, 30 Jan 2018 19:18:03 +0000 (11:18 -0800)]
Make loss_ops_test.py work with C API enabled.

PiperOrigin-RevId: 183861779

6 years agoAdd py2tf to contrib_py.
A. Unique TensorFlower [Tue, 30 Jan 2018 19:09:06 +0000 (11:09 -0800)]
Add py2tf to contrib_py.

PiperOrigin-RevId: 183860192

6 years ago[XLA] Fix tools broken by cl/183837856
Chris Leary [Tue, 30 Jan 2018 19:22:12 +0000 (11:22 -0800)]
[XLA] Fix tools broken by cl/183837856

PiperOrigin-RevId: 183862522

6 years agoMake loss_ops_test.py work with C API enabled.
Skye Wanderman-Milne [Tue, 30 Jan 2018 19:18:03 +0000 (11:18 -0800)]
Make loss_ops_test.py work with C API enabled.

PiperOrigin-RevId: 183861779

6 years agoAdd py2tf to contrib_py.
A. Unique TensorFlower [Tue, 30 Jan 2018 19:09:06 +0000 (11:09 -0800)]
Add py2tf to contrib_py.

PiperOrigin-RevId: 183860192

6 years agoCleanup: Ran clang-format on all *.{cc,h} files in tensorflow/contrib/.../*.{hh,c}.
A. Unique TensorFlower [Tue, 30 Jan 2018 18:43:03 +0000 (10:43 -0800)]
Cleanup: Ran clang-format on all *.{cc,h} files in tensorflow/contrib/.../*.{hh,c}.

PiperOrigin-RevId: 183855242

6 years agoPrepare variance to be exported for serving with the servo library.
A. Unique TensorFlower [Tue, 30 Jan 2018 18:18:36 +0000 (10:18 -0800)]
Prepare variance to be exported for serving with the servo library.

PiperOrigin-RevId: 183851026

6 years agoCleanup: Ran clang-format on files in tensorflow/core/.../*.{cc,h}.
A. Unique TensorFlower [Tue, 30 Jan 2018 18:05:04 +0000 (10:05 -0800)]
Cleanup: Ran clang-format on files in tensorflow/core/.../*.{cc,h}.

PiperOrigin-RevId: 183848459

6 years agoTensorFlow SavedModel loader: avoid segmentation fault when NewSession returns null
A. Unique TensorFlower [Tue, 30 Jan 2018 17:57:16 +0000 (09:57 -0800)]
TensorFlow SavedModel loader: avoid segmentation fault when NewSession returns null

PiperOrigin-RevId: 183846994

6 years agoCreate an interface to create hints for future toco conversions.
Andrew Selle [Tue, 30 Jan 2018 17:55:38 +0000 (09:55 -0800)]
Create an interface to create hints for future toco conversions.

Specifically, tf.contrib.lite.OpHint can create "breadcrumb"
hints that describe encapsulation of multiple TensorFlow ops
that make up a TensorFlow lite builtin or custom op. These
can later be replaced with stub versions in a GraphDef or
SavedModel.

PiperOrigin-RevId: 183846742

6 years agoAdd BF16 test cases for pad.
Yuanzhong Xu [Tue, 30 Jan 2018 17:54:46 +0000 (09:54 -0800)]
Add BF16 test cases for pad.

PiperOrigin-RevId: 183846616

6 years agoReenable 'constant' test.
A. Unique TensorFlower [Tue, 30 Jan 2018 17:42:48 +0000 (09:42 -0800)]
Reenable 'constant' test.

PiperOrigin-RevId: 183845007

6 years agoFixes broken link in documentation.
Shivani Agrawal [Tue, 30 Jan 2018 17:21:57 +0000 (09:21 -0800)]
Fixes broken link in documentation.

PiperOrigin-RevId: 183842485

6 years ago[XLA] Plumb build options via local API.
Chris Leary [Tue, 30 Jan 2018 16:43:37 +0000 (08:43 -0800)]
[XLA] Plumb build options via local API.

* Break build options into their own translation unit for use from local client
  and to mirror ExecutableRunOptions.
* Add some ToString()s to aid debugging.
* Add HLO graph generation regex to build options.
* Add SWIG type map for ExecutableBuildOptions.

Also fix a build issue occurring on some platforms with triangular_solve.

PiperOrigin-RevId: 183837856

6 years agoChanged the heap simulator to allow it to be configured about whether to issue Alloc...
A. Unique TensorFlower [Tue, 30 Jan 2018 16:35:46 +0000 (08:35 -0800)]
Changed the heap simulator to allow it to be configured about whether to issue Alloc/Free for constants, and enable buffer sharing.

PiperOrigin-RevId: 183836922

6 years agoSupport `mode` option to discriminator function in GANEstimator.
A. Unique TensorFlower [Tue, 30 Jan 2018 16:08:27 +0000 (08:08 -0800)]
Support `mode` option to discriminator function in GANEstimator.

This supports operations like batch normalization, which have different train and eval behavior.

PiperOrigin-RevId: 183833519

6 years agoAdds loss_reduction argument to baseline estimators.
Makoto Uchida [Tue, 30 Jan 2018 06:27:11 +0000 (22:27 -0800)]
Adds loss_reduction argument to baseline estimators.

PiperOrigin-RevId: 183783628

6 years agoTFE: Register a GPU kernel for tfe.py_func.
Akshay Agrawal [Tue, 30 Jan 2018 02:30:59 +0000 (18:30 -0800)]
TFE: Register a GPU kernel for tfe.py_func.

PiperOrigin-RevId: 183765122

6 years agoRemove Identity nodes if num_inputs * num_outputs <= num_inputs + num_outputs. Except...
A. Unique TensorFlower [Tue, 30 Jan 2018 01:50:56 +0000 (17:50 -0800)]
Remove Identity nodes if num_inputs * num_outputs <= num_inputs + num_outputs. Exceptions are Identity nodes after Variable nodes, and Identity nodes after Switch nodes when removing the node would require anchoring a control dependency on the Switch.
Another exception is Identity nodes where inputs or outputs cross a device boundary, since we are not allowed to remove Identity nodes after _Recv that might be inserted in the graph later.

PiperOrigin-RevId: 183759826

6 years agoUse new Operation._set_attr method instead of modifying node_def directly.
Skye Wanderman-Milne [Tue, 30 Jan 2018 01:48:17 +0000 (17:48 -0800)]
Use new Operation._set_attr method instead of modifying node_def directly.

Once calling the C API from TF's Python code is enabled, the NodeDef
returned by Operation.node_def will no longer be the NodeDef sent to
TF's runtime, meaning any changes to it will have no effect. Use
_set_attr instead, which works with and without the C API enabled.

PiperOrigin-RevId: 183759464

6 years ago[TF:XLA] Complete the TriangularSolve implementation.
A. Unique TensorFlower [Tue, 30 Jan 2018 01:25:45 +0000 (17:25 -0800)]
[TF:XLA] Complete the TriangularSolve implementation.

The previous version only handled the case of left_side=false, lower=true, transpose_a=true, conjugate_a=false. This updated implementation handles all 16 combinations of those boolean options, and also instantiates the corresponding MatrixTriangularSolve TF op.

To improve compile times and potentially FLOP performance, when lower=true the within-block subroutine used on the diagonal blocks is now a left-looking variant implemented with an XLA HLO While loop.

This update also slightly generalizes BatchDot in tf2xla/lib to accept separate conjugation arguments (in addition to transpose arguments).

PiperOrigin-RevId: 183756639

6 years agoRemove HloRunner::ReadModule.
Mark Heffernan [Tue, 30 Jan 2018 01:09:21 +0000 (17:09 -0800)]
Remove HloRunner::ReadModule.
Replace with methods which explicitly specify the HLO file format.
ReadModule would automatically determine the format of the file (HLO text,
text proto, or binary proto). However, automatic determination did not work
well because the underlying TF code which read protos from files
unconditionally emitted error messages to stderr in case of parsing error
resulting in confusing and irrelevant error messages to the user.

PiperOrigin-RevId: 183754369

6 years agoAdd support for the assert statement.
A. Unique TensorFlower [Tue, 30 Jan 2018 01:05:21 +0000 (17:05 -0800)]
Add support for the assert statement.

PiperOrigin-RevId: 183753774

6 years agoMaking a bunch of edits to the Getting Started with Premade Estimators doc for consis...
A. Unique TensorFlower [Tue, 30 Jan 2018 00:50:27 +0000 (16:50 -0800)]
Making a bunch of edits to the Getting Started with Premade Estimators doc for consistency and correctness.

PiperOrigin-RevId: 183751330

6 years agoAdds prediction_hooks into EstimatorSpec.
Jianwei Xie [Tue, 30 Jan 2018 00:22:43 +0000 (16:22 -0800)]
Adds prediction_hooks into EstimatorSpec.

PiperOrigin-RevId: 183747105

6 years agoGCS: Add client-side throttle.
Brennan Saeta [Mon, 29 Jan 2018 23:41:11 +0000 (15:41 -0800)]
GCS: Add client-side throttle.

This throttle is loosely based on a leaky bucket configuration that captures
both the cost of the requests as well as the bandwidth consumed into a single
token value.

PiperOrigin-RevId: 183740223

6 years agoMake with_c_api more robust and enable C API in most of saved_model_test.py.
Skye Wanderman-Milne [Mon, 29 Jan 2018 23:34:09 +0000 (15:34 -0800)]
Make with_c_api more robust and enable C API in most of saved_model_test.py.

This change makes the test_util.with_c_api decorator call
reset_default_graph() after enabling or disabling the C API instead of
creating a new Graph. This makes it more robust to tests that call
reset_default_graph(), which requires that the current default graph
isn't nested (which the C API-enabled Graph previously was).

In addition, enables the C API with saved_model_test.py (which
required the above change). A few tests still need further changes,
which I'll post in subsequent patches.

PiperOrigin-RevId: 183739148

6 years agoAdd new StrCat utility functions for creating failed Status'es.
Bjarke Hammersholt Roune [Mon, 29 Jan 2018 23:21:16 +0000 (15:21 -0800)]
Add new StrCat utility functions for creating failed Status'es.

PiperOrigin-RevId: 183737063

6 years agoAdd transformation that exchanges a Reshape followed by an activation function.
A. Unique TensorFlower [Mon, 29 Jan 2018 23:11:32 +0000 (15:11 -0800)]
Add transformation that exchanges a Reshape followed by an activation function.

PiperOrigin-RevId: 183735457

6 years agoMake TFLite SpaceToBatchND op have parity with TF SpaceToBatchND op.
Nupur Garg [Mon, 29 Jan 2018 23:06:30 +0000 (15:06 -0800)]
Make TFLite SpaceToBatchND op have parity with TF SpaceToBatchND op.

PiperOrigin-RevId: 183734695

6 years agoUse Popen.communicate() instead of read() in stacktrace_handler_test.py.
Skye Wanderman-Milne [Mon, 29 Jan 2018 22:40:07 +0000 (14:40 -0800)]
Use Popen.communicate() instead of read() in stacktrace_handler_test.py.

This avoids potential deadlock, see the warnings in
https://docs.python.org/2/library/subprocess.html#popen-objects. I
found that enabling the C API caused us to deadlock without this
change.

PiperOrigin-RevId: 183730170

6 years agoSet default signal handler for SIGINT (keyboard interrupt).
Russell Power [Mon, 29 Jan 2018 22:37:17 +0000 (14:37 -0800)]
Set default signal handler for SIGINT (keyboard interrupt).

The default signal handling for Python delivers the signal to the thread for
processing; if broad exceptions are being caught, this can often result in the
interrupt being swallowed.

PiperOrigin-RevId: 183729637

6 years ago[TF:XLA] Bump open source llvm revision to r323630
Sanjoy Das [Mon, 29 Jan 2018 22:31:51 +0000 (14:31 -0800)]
[TF:XLA] Bump open source llvm revision to r323630

PiperOrigin-RevId: 183728562

6 years agoSwitch over to max_pool_v2 in Python
Russell Power [Mon, 29 Jan 2018 22:26:43 +0000 (14:26 -0800)]
Switch over to max_pool_v2 in Python

This fix is a follow up to 11875 so that MaxPool in Python
use v2 version. As 11875 has been merged some time ago,
this fix conforms to the deprecation policy.

This fix is realted to 11875 and 4746.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
PiperOrigin-RevId: 183727668

6 years agoRevise the decorator transformer and add tests that clarify when can decorator inform...
A. Unique TensorFlower [Mon, 29 Jan 2018 22:04:16 +0000 (14:04 -0800)]
Revise the decorator transformer and add tests that clarify when can decorator information appear in the AST.

PiperOrigin-RevId: 183723446

6 years agoJava: Update to 1.5.0
Asim Shankar [Mon, 29 Jan 2018 21:36:09 +0000 (13:36 -0800)]
Java: Update to 1.5.0

PiperOrigin-RevId: 183718481

6 years agoSupport shrink_axis_mask argument of StridedSlice Op for TfLite.
A. Unique TensorFlower [Mon, 29 Jan 2018 20:43:46 +0000 (12:43 -0800)]
Support shrink_axis_mask argument of StridedSlice Op for TfLite.

PiperOrigin-RevId: 183709796

6 years agoRemove the trailing '/' in the tensor name when loading checkpoints
A. Unique TensorFlower [Mon, 29 Jan 2018 20:42:09 +0000 (12:42 -0800)]
Remove the trailing '/' in the tensor name when loading checkpoints

PiperOrigin-RevId: 183709590

6 years agoA few tweaks to add const to functions and member fields.
A. Unique TensorFlower [Mon, 29 Jan 2018 20:15:12 +0000 (12:15 -0800)]
A few tweaks to add const to functions and member fields.

PiperOrigin-RevId: 183705898

6 years agoPass maximum_iterations hint to tf.while_loop if possible.
A. Unique TensorFlower [Mon, 29 Jan 2018 20:14:15 +0000 (12:14 -0800)]
Pass maximum_iterations hint to tf.while_loop if possible.

PiperOrigin-RevId: 183705773

6 years agoEnsure that non-recursive conversion is identity transformation wrt all types of...
A. Unique TensorFlower [Mon, 29 Jan 2018 20:12:41 +0000 (12:12 -0800)]
Ensure that non-recursive conversion is identity transformation wrt all types of function calls by only failing on unresolved symbols if they're needed.
Simplify code structure all around. Remove the awkward activity analysis that deemed a function parameter as "modified". Consolidate activity analysis by tracking function parameters and returned symbols separately. Strengthen the type inference a little by using more interpret-like constructs.

PiperOrigin-RevId: 183705547

6 years ago[tf.data] Handle `tf.SparseTensor` elements in the stats ops.
Derek Murray [Mon, 29 Jan 2018 20:09:05 +0000 (12:09 -0800)]
[tf.data] Handle `tf.SparseTensor` elements in the stats ops.

PiperOrigin-RevId: 183705008

6 years agoAdd input and sequence_length accessor to TrainingHelper.
Adam Roberts [Mon, 29 Jan 2018 19:51:08 +0000 (11:51 -0800)]
Add input and sequence_length accessor to TrainingHelper.

PiperOrigin-RevId: 183701716

6 years agoMake TFLite Mean op have parity with TF Reduce Mean op by changing the
A. Unique TensorFlower [Mon, 29 Jan 2018 19:47:02 +0000 (11:47 -0800)]
Make TFLite Mean op have parity with TF Reduce Mean op by changing the
representation of axis from an attribute to a tensor.

PiperOrigin-RevId: 183701017

6 years ago[TF:XLA] Add xla_dump_per_pass_hlo_proto_to flag and rename xla_dump_hlo_proto_to...
Nick Desaulniers [Mon, 29 Jan 2018 19:41:31 +0000 (11:41 -0800)]
[TF:XLA] Add xla_dump_per_pass_hlo_proto_to flag and rename xla_dump_hlo_proto_to and xla_dump_prepass_hlo_proto_to.

Renamed:
xla_dump_hlo_proto_to -> xla_dump_optimized_hlo_proto_to
xla_dump_prepass_hlo_proto_to -> xla_dump_unoptimized_hlo_proto_to

xla_dump_per_pass_hlo_proto_to takes a directory from which to dump the serialized HLO
module protos after each HLO pass. This will help us compare HLO modules as
they change during HLO passes, such as what they evaluate to, or how fast they
perform.

The directory passed will contain multiple protos with the filename format:
module_<module id>.<pass number>.<pipeline_name>.after_<pass name>.pb
example:
module_0000.0009.simplification.after_dce.pb
such that pass number 0000_* is the first pass run, followed immediately by
pass number 0001_*.
PiperOrigin-RevId: 183700119

6 years ago[TF:XLA] Implement ReverseSequence operator.
Peter Hawkins [Mon, 29 Jan 2018 19:31:07 +0000 (11:31 -0800)]
[TF:XLA] Implement ReverseSequence operator.

PiperOrigin-RevId: 183698184

6 years agoMake optimize_for_inference_test.py work the C API enabled.
Skye Wanderman-Milne [Mon, 29 Jan 2018 19:20:39 +0000 (11:20 -0800)]
Make optimize_for_inference_test.py work the C API enabled.

PiperOrigin-RevId: 183696425

6 years agoAdd C0326 bad-whitespace error to pylint sanity check.
Yifei Feng [Mon, 29 Jan 2018 18:42:32 +0000 (10:42 -0800)]
Add C0326 bad-whitespace error to pylint sanity check.

PiperOrigin-RevId: 183689499

6 years agoMake TFLite BatchToSpaceND op have parity with TF BatchToSpaceND op.
Nupur Garg [Mon, 29 Jan 2018 18:31:23 +0000 (10:31 -0800)]
Make TFLite BatchToSpaceND op have parity with TF BatchToSpaceND op.

PiperOrigin-RevId: 183687487

6 years agotfdbg: let session wrappers handle empty fetches correctly
Shanqing Cai [Mon, 29 Jan 2018 18:22:10 +0000 (10:22 -0800)]
tfdbg: let session wrappers handle empty fetches correctly

Fixes: #15882
PiperOrigin-RevId: 183685645

6 years agoFix a comment
Yu-Cheng Ling [Mon, 29 Jan 2018 18:19:58 +0000 (10:19 -0800)]
Fix a comment

PiperOrigin-RevId: 183685209

6 years agoReduce memory wasted by GCS cache by shrinking buffer capacity, after a cache fill...
A. Unique TensorFlower [Mon, 29 Jan 2018 18:12:42 +0000 (10:12 -0800)]
Reduce memory wasted by GCS cache by shrinking buffer capacity, after a cache fill completes.

PiperOrigin-RevId: 183683856

6 years agoInternal change
Yifei Feng [Mon, 29 Jan 2018 18:01:50 +0000 (10:01 -0800)]
Internal change

PiperOrigin-RevId: 183681594

6 years agoMake `init_scope` preserve the active name scope.
Akshay Agrawal [Mon, 29 Jan 2018 17:57:20 +0000 (09:57 -0800)]
Make `init_scope` preserve the active name scope.

This ensures that operations nested under an `init_scope` do not ignore name scopes that were opened in a function-building graph. In light of cl/183320576, which causes `tfe.defun` to automatically hoist variables out of its function-building graph, this change also eliminates logic in make_template that special-cased the first call when `create_graph_function` was True.

PiperOrigin-RevId: 183680794

6 years ago[tf.data] Robust `output_types` and `output_shapes` if `output_classes` contains...
Shivani Agrawal [Mon, 29 Jan 2018 17:48:47 +0000 (09:48 -0800)]
[tf.data] Robust `output_types` and `output_shapes` if `output_classes` contains SparseTensor.

PiperOrigin-RevId: 183679584

6 years agoTFTS: Remove a race condition in lstm_test (switch to resource variables)
Allen Lavoie [Mon, 29 Jan 2018 17:44:35 +0000 (09:44 -0800)]
TFTS: Remove a race condition in lstm_test (switch to resource variables)

PiperOrigin-RevId: 183679060

6 years agoMake TFLite Transpose op have parity with TF Transpose op.
Nupur Garg [Mon, 29 Jan 2018 17:25:42 +0000 (09:25 -0800)]
Make TFLite Transpose op have parity with TF Transpose op.

PiperOrigin-RevId: 183676663

6 years agoRemove unused class members
A. Unique TensorFlower [Mon, 29 Jan 2018 15:27:48 +0000 (07:27 -0800)]
Remove unused class members

PiperOrigin-RevId: 183662473

6 years agotfdbg: add tensorboard debugger plugin option to three existing examples
Shanqing Cai [Mon, 29 Jan 2018 15:11:29 +0000 (07:11 -0800)]
tfdbg: add tensorboard debugger plugin option to three existing examples

PiperOrigin-RevId: 183661140

6 years ago[XLA] Set layout of GTE instructions inside fusion nodes.
Justin Lebar [Sun, 28 Jan 2018 19:21:58 +0000 (11:21 -0800)]
[XLA] Set layout of GTE instructions inside fusion nodes.

Other than the root and parameters of a fusion computation, most other
instructions in a fusion computation don't have a layout.  GTEs are an
exception; they should inherit their layout from their operand, which
must be another GTE or a parameter.

Previously LayoutAssignment left GTEs alone, assuming they came in with
the right layout.  But this isn't correct, and in fact LayoutAssignment
cleared the layouts of every non-fused instruction before assigning them
for exactly this reason.  If we'd done the same to fused instructions,
it would have caught this bug, so we make that change here as well.  (We
simplify this loop by removing the check for kOutfeed -- outfeeds do not
produce a result, so there's no shape to keep.)

PiperOrigin-RevId: 183595627

6 years ago[XLA] Show layouts of tuple-shaped instructions (other than kTuple) in graphs.
Justin Lebar [Sun, 28 Jan 2018 18:49:33 +0000 (10:49 -0800)]
[XLA] Show layouts of tuple-shaped instructions (other than kTuple) in graphs.

For example the batch-norm ops return a tuple, and those values' layouts
are significant.  We still hide the layout on tuples, since this can be
noisy.

PiperOrigin-RevId: 183594622

6 years ago[XLA] Reset ShapeVisitor's state between runs of the verifier.
Justin Lebar [Sun, 28 Jan 2018 18:12:55 +0000 (10:12 -0800)]
[XLA] Reset ShapeVisitor's state between runs of the verifier.

We create the ShapeVisitor once per pass pipeline.  Without this change,
after our ShapeVisitor has checked an instruction, it will never again
check that instruction *or any of its transitive inputs*.  Yikes.

PiperOrigin-RevId: 183593437

6 years agoFix use of uninitialied value.
A. Unique TensorFlower [Sun, 28 Jan 2018 03:59:13 +0000 (19:59 -0800)]
Fix use of uninitialied value.

PiperOrigin-RevId: 183558128

6 years agoInternal Change
Zhixian Yan [Sun, 28 Jan 2018 01:38:59 +0000 (17:38 -0800)]
Internal Change

PiperOrigin-RevId: 183551521

6 years agoRemove unused BUILD dependencies
A. Unique TensorFlower [Sat, 27 Jan 2018 13:12:06 +0000 (05:12 -0800)]
Remove unused BUILD dependencies

PiperOrigin-RevId: 183514731

6 years agoAdds a deprecated_alias utility function with which to deprecate unmodified aliases.
Martin Wicke [Sat, 27 Jan 2018 07:35:51 +0000 (23:35 -0800)]
Adds a deprecated_alias utility function with which to deprecate unmodified aliases.

PiperOrigin-RevId: 183495796

6 years ago[XLA] Make DeviceMemoryAllocator::platform() a const pointer.
Justin Lebar [Sat, 27 Jan 2018 06:57:08 +0000 (22:57 -0800)]
[XLA] Make DeviceMemoryAllocator::platform() a const pointer.

PiperOrigin-RevId: 183493603

6 years ago[TF:XLA] Update stale comments to match function names.
A. Unique TensorFlower [Sat, 27 Jan 2018 06:19:43 +0000 (22:19 -0800)]
[TF:XLA] Update stale comments to match function names.

PiperOrigin-RevId: 183491729

6 years agoFix build: add std:: to max() in tensorflow/contrib/tpu/profiler/capture_tpu_profile.cc.
A. Unique TensorFlower [Sat, 27 Jan 2018 04:51:06 +0000 (20:51 -0800)]
Fix build: add std:: to max() in tensorflow/contrib/tpu/profiler/capture_tpu_profile.cc.

PiperOrigin-RevId: 183486778

6 years agoInternal change.
A. Unique TensorFlower [Sat, 27 Jan 2018 02:59:15 +0000 (18:59 -0800)]
Internal change.

PiperOrigin-RevId: 183479688

6 years agoAdd a feature to automatically recapture the traces when no trace event is collected.
A. Unique TensorFlower [Sat, 27 Jan 2018 02:00:08 +0000 (18:00 -0800)]
Add a feature to automatically recapture the traces when no trace event is collected.

PiperOrigin-RevId: 183474367

6 years agoRemove protobuf patch that was installed to resolve #8394. It appears to not be neces...
A. Unique TensorFlower [Sat, 27 Jan 2018 01:57:49 +0000 (17:57 -0800)]
Remove protobuf patch that was installed to resolve #8394. It appears to not be necessary any longer.

PiperOrigin-RevId: 183474194

6 years agoCreate different data for each Literal when creating fake data.
Mark Heffernan [Sat, 27 Jan 2018 01:50:03 +0000 (17:50 -0800)]
Create different data for each Literal when creating fake data.
Thread a generator through the functions for creating fake arguments so the same
generator can be reused which avoids repeating the same data patterns for each
argument generated.

Also tweak the position-dependent biasing heuristic to create both positive and
negative numbers for small literals.

PiperOrigin-RevId: 183473588

6 years agoFixed bug: inconsistency with how damping normalization was applied to ConvDiagonalFB...
A. Unique TensorFlower [Sat, 27 Jan 2018 01:38:06 +0000 (17:38 -0800)]
Fixed bug: inconsistency with how damping normalization was applied to ConvDiagonalFB blocks.

PiperOrigin-RevId: 183472440

6 years agoRaise to 4 the shard counts of //third_party/tensorflow/contrib/{factorization:kmeans...
A. Unique TensorFlower [Sat, 27 Jan 2018 01:18:16 +0000 (17:18 -0800)]
Raise to 4 the shard counts of //third_party/tensorflow/contrib/{factorization:kmeans_test,linear_optimizer:sdca_estimator_test}

These tests were getting flaky timeouts when run under asan, sometimes taking
longer than the 5 minute timeout.  Increasing the shard count to 4 seems to be
sufficient to cause them not to time out.

PiperOrigin-RevId: 183470183

6 years ago[XLA] Add a DeviceAllocator* argument to compilation.
Justin Lebar [Sat, 27 Jan 2018 01:12:23 +0000 (17:12 -0800)]
[XLA] Add a DeviceAllocator* argument to compilation.

In a later change, the GPU backend will use this allocator to reserve
scratch memory when trying out different convolution algorithms during
compilation.

PiperOrigin-RevId: 183469579

6 years agoAdd reduce-precision to evaluator and add implicit broadcast remover pass.
Mark Heffernan [Sat, 27 Jan 2018 00:58:00 +0000 (16:58 -0800)]
Add reduce-precision to evaluator and add implicit broadcast remover pass.
The reduce precision support is cribbed from the CPU/GPU LLVM-emitted
implementation. The implicit broadcast pass removes any implicit broadcasts in
the module replacing them with the equivalent explicit broadcast and reshape
instructions.

PiperOrigin-RevId: 183467648

6 years agoAdd C0301 line-too-long error to pylint sanity check.
Yifei Feng [Sat, 27 Jan 2018 00:53:59 +0000 (16:53 -0800)]
Add C0301 line-too-long error to pylint sanity check.

PiperOrigin-RevId: 183467186

6 years ago[tf.data] Support for initializing all the tables of the given graph.
Shivani Agrawal [Sat, 27 Jan 2018 00:51:25 +0000 (16:51 -0800)]
[tf.data] Support for initializing all the tables of the given graph.

PiperOrigin-RevId: 183466905

6 years agoAdd bidirectional sequence RNN to TFLite Ops.
A. Unique TensorFlower [Sat, 27 Jan 2018 00:36:55 +0000 (16:36 -0800)]
Add bidirectional sequence RNN to TFLite Ops.

PiperOrigin-RevId: 183465032

6 years ago[XLA] Don't print "{no layout}" if there is no layout.
A. Unique TensorFlower [Sat, 27 Jan 2018 00:23:40 +0000 (16:23 -0800)]
[XLA] Don't print "{no layout}" if there is no layout.

PiperOrigin-RevId: 183463264

6 years ago[XLA] (Re-land) Add HLO matcher for CustomCall that accepts a call target.
Justin Lebar [Fri, 26 Jan 2018 23:54:38 +0000 (15:54 -0800)]
[XLA] (Re-land) Add HLO matcher for CustomCall that accepts a call target.

Now with less build breakage!

PiperOrigin-RevId: 183458987

6 years ago[XLA] optimize NearComparator#ExpectLiteralsNear()
Nick Desaulniers [Fri, 26 Jan 2018 23:01:40 +0000 (15:01 -0800)]
[XLA] optimize NearComparator#ExpectLiteralsNear()

While tracking down the issue of timeouts when running THE ISOLATOR, it was
observed that NearComparator#ExpectLiteralsNear() could be optimized in the
case of matching layouts to not compute multi indexes.

In the process of tracking down timeouts in THE ISOLATOR, I had assumed that
time spent was dominated by either generating input data, executing the input
data on various backends, or comparing the data. Never assume you know where
the time is spent in a program; the profiler may surprise you.

After making that optimization and then profiling the code before and after, I
was surprised by the profile. Image the shock, horror, and disgust I
experienced when discovering that runs of THE ISOLATOR were dominated (45%) by
calls to Literal#ToString() in NearComparator#ExpectLiteralsNear() for huge
(>120 million elements) literals that failed comparisons.  No wonder passing
shards of THE ISOLATOR were fast, and failing shards were slow.

Further, computing multi indexes many times is expensive enough (18%) to show
up in profiles, so avoid calculating it until it is necessary.

The optimizations in this patch:
* Don't call Literal#ToString() on huge literals that are going to get written
  to disk anyways. The utility of printing said literal to stdout is suspect.
* Initialize NearComparator#miscompares_ to false, only update miscompares_ and
  other stats when miscompare occurs.
* Split NearComparator#ExpectLiteralsNear() into two, since we only need to log
  and update stats if an actual miscompare occurs.
* Add fast path in NearComparator#ExpectLiteralsNear() for case of matching
  layouts, being careful not to compute multi index unless mismatch actually
  occurs.

This optimized NearComparator#ExpectLiteralsNear() for the case of many element
literals, with few miscompares. For many miscompares, we cannot avoid
calculating multi indexes, but can fast path for equal layouts. For zero
miscompares, we can at least fast path in the case of matching layouts.

Before this CL, a run of THE ISOLATOR for a single literal with >120 million
elements and a few miscompares took 379s (6.3m). With this CL, the same test
case now takes 44s.

Beautiful flame graphs omitted from public commit message, regrettably.

PiperOrigin-RevId: 183451138