platform/upstream/tensorflow.git
6 years agoCleanup markdown errors in `Bijector`.
Joshua V. Dillon [Tue, 6 Feb 2018 01:55:26 +0000 (17:55 -0800)]
Cleanup markdown errors in `Bijector`.

PiperOrigin-RevId: 184616392

6 years ago[XLA] Add HloBindings::ToString().
Justin Lebar [Tue, 6 Feb 2018 01:45:26 +0000 (17:45 -0800)]
[XLA] Add HloBindings::ToString().

PiperOrigin-RevId: 184615306

6 years agoCorrectly treat "devices=/gpu:0" argument of replicate_model_fn.
Igor Saprykin [Tue, 6 Feb 2018 01:24:31 +0000 (17:24 -0800)]
Correctly treat "devices=/gpu:0" argument of replicate_model_fn.

At the moment if "devices=/GPU:0" are specified by the user, then variables are going to be placed on the GPU.  However, if "devices=/gpu:0" are given, then they are going to be placed on the CPU.  Instead, the latter case should be equivalent to the former case.

PiperOrigin-RevId: 184612823

6 years agoMisc cleanups and tweaks:
Mingsheng Hong [Tue, 6 Feb 2018 01:16:27 +0000 (17:16 -0800)]
Misc cleanups and tweaks:
1. Removed obsolete constructors in ProcessLunctionLibraryRuntime
2. Add const annotations to Tensor::PrintOneDim(), and removed unnecessary vector copy.

PiperOrigin-RevId: 184611531

6 years ago[XLA:GPU] Split IrEmitter{Unn,N}ested out of ir_emitter.h.
Justin Lebar [Tue, 6 Feb 2018 01:11:39 +0000 (17:11 -0800)]
[XLA:GPU] Split IrEmitter{Unn,N}ested out of ir_emitter.h.

Also add a bunch of clarifying comments.

PiperOrigin-RevId: 184610674

6 years agoSupport negative axis in concatenation
A. Unique TensorFlower [Tue, 6 Feb 2018 00:32:38 +0000 (16:32 -0800)]
Support negative axis in concatenation

PiperOrigin-RevId: 184605786

6 years agoShard linear operator tests.
A. Unique TensorFlower [Tue, 6 Feb 2018 00:12:19 +0000 (16:12 -0800)]
Shard linear operator tests.

PiperOrigin-RevId: 184602704

6 years agoAdd filepaths to test_local support.
Amit Patankar [Tue, 6 Feb 2018 00:08:16 +0000 (16:08 -0800)]
Add filepaths to test_local support.

PiperOrigin-RevId: 184602010

6 years agoRemove makefile build dependency on all_opensource_files, as part of the effort to...
Yifei Feng [Tue, 6 Feb 2018 00:04:06 +0000 (16:04 -0800)]
Remove makefile build dependency on all_opensource_files, as part of the effort to remove all_opensource_files #15758.

PiperOrigin-RevId: 184601439

6 years ago"frame_name" attr must be altered when importing/exporting MetaGraphDefs.
Skye Wanderman-Milne [Mon, 5 Feb 2018 23:49:57 +0000 (15:49 -0800)]
"frame_name" attr must be altered when importing/exporting MetaGraphDefs.

The frame_name attr of Enter operations must be the name of the
associated WhileLoopContext, otherwise taking the gradient of the loop
will result in frame errors.

I'm not happy that the export logic is in meta_graph.py (all other
control flow de/serialization is in control_flow_ops.py). However, I
can't think of how else to do it, since only export_scoped_meta_graph
has access to the NodeDefs being exported.

PiperOrigin-RevId: 184599323

6 years ago[XLA] Sink layout sensitivity from CSE into HloInstruction::Identical, and make it...
A. Unique TensorFlower [Mon, 5 Feb 2018 23:46:50 +0000 (15:46 -0800)]
[XLA] Sink layout sensitivity from CSE into HloInstruction::Identical, and make it the default.

PiperOrigin-RevId: 184598903

6 years agoMake fold batch norm code use OneofPattern and rearrange functions to (maybe) be...
Suharsh Sivakumar [Mon, 5 Feb 2018 23:32:32 +0000 (15:32 -0800)]
Make fold batch norm code use OneofPattern and rearrange functions to (maybe) be more readable.

PiperOrigin-RevId: 184597111

6 years agoAssign total_loss in order not to crash if training loop exists early.
A. Unique TensorFlower [Mon, 5 Feb 2018 23:30:54 +0000 (15:30 -0800)]
Assign total_loss in order not to crash if training loop exists early.

PiperOrigin-RevId: 184596877

6 years agoAdding TensorSpec to represent the specification of Tensors.
Sergio Guadarrama [Mon, 5 Feb 2018 23:16:29 +0000 (15:16 -0800)]
Adding TensorSpec to represent the specification of Tensors.

PiperOrigin-RevId: 184594856

6 years agoVerify tflite model in TFLite Java API
A. Unique TensorFlower [Mon, 5 Feb 2018 23:14:20 +0000 (15:14 -0800)]
Verify tflite model in TFLite Java API

PiperOrigin-RevId: 184594561

6 years agoAdd logging to diagnose device properties parsing problem in Grappler.
Max Galkin [Mon, 5 Feb 2018 23:10:44 +0000 (15:10 -0800)]
Add logging to diagnose device properties parsing problem in Grappler.

PiperOrigin-RevId: 184594084

6 years agoFix CBLAS Conv reference implementation in TFLite.
Yu-Cheng Ling [Mon, 5 Feb 2018 23:05:43 +0000 (15:05 -0800)]
Fix CBLAS Conv reference implementation in TFLite.

PiperOrigin-RevId: 184592951

6 years agoAutomated g4 rollback of changelist 184573795
Alexandre Passos [Mon, 5 Feb 2018 22:47:23 +0000 (14:47 -0800)]
Automated g4 rollback of changelist 184573795

PiperOrigin-RevId: 184590080

6 years agoBackward pass implementation for fusion optimizer.
A. Unique TensorFlower [Mon, 5 Feb 2018 22:43:35 +0000 (14:43 -0800)]
Backward pass implementation for fusion optimizer.

PiperOrigin-RevId: 184589487

6 years ago[XLA] Fix documentation for Clamp.
A. Unique TensorFlower [Mon, 5 Feb 2018 22:38:07 +0000 (14:38 -0800)]
[XLA] Fix documentation for Clamp.

PiperOrigin-RevId: 184588630

6 years ago[TF:XLA] Implement GatherNd.
Peter Hawkins [Mon, 5 Feb 2018 22:12:02 +0000 (14:12 -0800)]
[TF:XLA] Implement GatherNd.

PiperOrigin-RevId: 184584104

6 years ago[tf.data] Fix use-after-free bug when closing down an input pipeline.
Derek Murray [Mon, 5 Feb 2018 21:43:52 +0000 (13:43 -0800)]
[tf.data] Fix use-after-free bug when closing down an input pipeline.

This fix affects the distributed runtime; DirectSession use is unaffected.

Before this change, an iterator that used a background prefetching
thread might attempt to use a captured FunctionLibraryRuntime from a
subgraph that had been deregistered (and hence its
FunctionLibraryRuntime would have been deleted). This change
introduces a mechanism for "cloning" the necessary parts of the
FunctionLibraryRuntime so that it can be owned by the
IteratorResource.

PiperOrigin-RevId: 184579490

6 years ago[XLA] Add tests for Clamp of S32 and U32 vectors with broadcasted scalars.
A. Unique TensorFlower [Mon, 5 Feb 2018 21:43:08 +0000 (13:43 -0800)]
[XLA] Add tests for Clamp of S32 and U32 vectors with broadcasted scalars.

PiperOrigin-RevId: 184579375

6 years agoFixes issue where external control dependencies in while loops are dropped.
Alexandre Passos [Mon, 5 Feb 2018 21:03:53 +0000 (13:03 -0800)]
Fixes issue where external control dependencies in while loops are dropped.

Fixes #15891

PiperOrigin-RevId: 184573795

6 years agocontrib/rnn: Fix #16703
Asim Shankar [Mon, 5 Feb 2018 20:40:51 +0000 (12:40 -0800)]
contrib/rnn: Fix #16703
(Bug introduced in
https://github.com/tensorflow/tensorflow/commit/3f579020bab8f00e4621e9c7c740cbf13136a809)

Kudos to @akhti for pointing this out.

PiperOrigin-RevId: 184570448

6 years agoBug fix: Don't dereference nullptr in OpKernelContext::input_alloc_attr().
A. Unique TensorFlower [Mon, 5 Feb 2018 20:16:04 +0000 (12:16 -0800)]
Bug fix: Don't dereference nullptr in OpKernelContext::input_alloc_attr().

PiperOrigin-RevId: 184566770

6 years ago[TF:XLA] Making constant folding deterministic.
Yunxing Dai [Mon, 5 Feb 2018 20:15:10 +0000 (12:15 -0800)]
[TF:XLA] Making constant folding deterministic.

Making constant folding deterministic by doing DFS deterministically and inserting a serialization point based on nodes' names.

This is the last source of non-determinism remaining in the TF:XLA stack.

RELNOTES: Constant folding pass is now deterministic.
PiperOrigin-RevId: 184566644

6 years agoSerialize the evaluation of the AssignAdd nodes to make the result more
Benoit Steiner [Mon, 5 Feb 2018 20:08:36 +0000 (12:08 -0800)]
Serialize the evaluation of the AssignAdd nodes to make the result more
deterministic
Improved testing

PiperOrigin-RevId: 184565483

6 years agoSupport parsing from text and fused op in contrib.
Yao Zhang [Mon, 5 Feb 2018 19:23:40 +0000 (11:23 -0800)]
Support parsing from text and fused op in contrib.

PiperOrigin-RevId: 184558131

6 years agoAutomated g4 rollback of changelist 184323369
Joshua V. Dillon [Mon, 5 Feb 2018 18:45:33 +0000 (10:45 -0800)]
Automated g4 rollback of changelist 184323369

PiperOrigin-RevId: 184551259

6 years agoProper reallocation of dynamic tensors.
A. Unique TensorFlower [Mon, 5 Feb 2018 18:39:18 +0000 (10:39 -0800)]
Proper reallocation of dynamic tensors.

PiperOrigin-RevId: 184550199

6 years agoMake flat_transforms_to_matrices and matrices_to_flat_transforms public (#781).
Dan Ringwalt [Mon, 5 Feb 2018 18:36:24 +0000 (10:36 -0800)]
Make flat_transforms_to_matrices and matrices_to_flat_transforms public (#781).

PiperOrigin-RevId: 184549704

6 years agoChanging the link to point to new android job.
Amit Patankar [Mon, 5 Feb 2018 18:16:02 +0000 (10:16 -0800)]
Changing the link to point to new android job.

PiperOrigin-RevId: 184546160

6 years ago[XLA] add Conditional to the local Python XLA client.
A. Unique TensorFlower [Mon, 5 Feb 2018 18:06:10 +0000 (10:06 -0800)]
[XLA] add Conditional to the local Python XLA client.

PiperOrigin-RevId: 184544483

6 years agoClarify that tf.contrib.image.rotate angles are counterclockwise.
Dan Ringwalt [Mon, 5 Feb 2018 17:49:01 +0000 (09:49 -0800)]
Clarify that tf.contrib.image.rotate angles are counterclockwise.

PiperOrigin-RevId: 184541776

6 years agoEnable aggressive identity node pruning in dependency optimizer.
A. Unique TensorFlower [Mon, 5 Feb 2018 17:33:42 +0000 (09:33 -0800)]
Enable aggressive identity node pruning in dependency optimizer.

PiperOrigin-RevId: 184539756

6 years agoGet control_flow_ops.py ready to support de/serializing nested control flow.
Skye Wanderman-Milne [Mon, 5 Feb 2018 16:41:54 +0000 (08:41 -0800)]
Get control_flow_ops.py ready to support de/serializing nested control flow.

With this change, ControlFlowContexts keep track of their nested
contexts (the reverse lookup as ControlFlowContext.outer_context).
This is to enable de/serializing the nested contexts of each "root"
context, and only adding the root contexts to collections. This allows
for simple deserialization of each root context by recursively
deserializing its nested contexts.

The de/serialization logic is disabled and the corresponding
control_flow.proto changes are omitted for now for forwards
compatability (i.e. three-week-old binaries must be ready to accept
the new proto format once its commited). After this is committed for
three weeks, I'll commit a follow-up change enabling the new behavior.

Design note: I chose to serialize the nested contexts, rather than the
outer contexts, because it makes it easy to deserialize the contexts
in topological order and to assign the right outer context. If we
serialized the outer contexts, there'd need to be some mechanism for
either sorting all the serialized contexts first, or deserializing all
of them and then doing another pass to assign the outer contexts.

PiperOrigin-RevId: 184533406

6 years agoInternal Change
A. Unique TensorFlower [Mon, 5 Feb 2018 16:32:18 +0000 (08:32 -0800)]
Internal Change

PiperOrigin-RevId: 184532417

6 years agoExpand the activity analysis to composite names.
A. Unique TensorFlower [Mon, 5 Feb 2018 15:56:27 +0000 (07:56 -0800)]
Expand the activity analysis to composite names.
Fix a bug in the cond template that caused bad syntax when there it no symbol that needs aliasing.
More refactoring in the process, including:
 * introduce the QN (qualified name) class to hold symbol information; it has value semantics and can generate the original symbol, a corresponding AST tree or a single-symbol form (e.g. "a.b" -> a_b)
 * allow the template mechanism to use QNs for substitutions
 * annotate *all* symbol nodes with their corresponding QN object; this is done as first step during static analysis, and automatically performed on all template expansions
 * start using typed annotation keys (Enum values) instead of plain strings
 * rename access.py to activity.py
 * sanitize nodes in template expansion by deep copying the AST without annotations, to avoid common references

PiperOrigin-RevId: 184528586

6 years agomini documentation fix
A. Unique TensorFlower [Mon, 5 Feb 2018 09:42:16 +0000 (01:42 -0800)]
mini documentation fix

PiperOrigin-RevId: 184496843

6 years agoFixed sequence_mask behavior on unknown shape.
A. Unique TensorFlower [Mon, 5 Feb 2018 09:03:32 +0000 (01:03 -0800)]
Fixed sequence_mask behavior on unknown shape.

`sequence_mask` crashed when fed with a tensor of unknown rank.
Added a test for that, and expanded a bit existing tests.

Also fixed pre-existing lint errors.

PiperOrigin-RevId: 184493239

6 years agoSupport for quantized LSTM models.
A. Unique TensorFlower [Mon, 5 Feb 2018 03:58:18 +0000 (19:58 -0800)]
Support for quantized LSTM models.

PiperOrigin-RevId: 184476753

6 years agoMinor fixes to the get started doc.
Mingsheng Hong [Sun, 4 Feb 2018 19:54:35 +0000 (11:54 -0800)]
Minor fixes to the get started doc.

PiperOrigin-RevId: 184457074

6 years agoAvoid retaining two copies of each constant in `ConstantOp`.
Derek Murray [Sun, 4 Feb 2018 19:24:51 +0000 (11:24 -0800)]
Avoid retaining two copies of each constant in `ConstantOp`.

Presently, the kernel keeps two copies of the constant tensor value, which can be large:
1. In the `ConstantOp::tensor_` field.
2. In the `OpKernel::def_` field (as an attr of the `NodeDef`).

Since we can be sure that `ConstantOp` will never need to access the
tensor value from `OpKernel::def_`, this change introduces a mechanism
for `OpKernel` implementations to store a stripped `NodeDef` in the
base class, and uses it in `ConstantOp` to avoid storing the tensor
value attr.

PiperOrigin-RevId: 184455793

6 years ago[XLA] Assign mandatory constraints in a DFS order and non-manatory constraints in...
Blake Hechtman [Sun, 4 Feb 2018 07:45:00 +0000 (23:45 -0800)]
[XLA] Assign mandatory constraints in a DFS order and non-manatory constraints in a BFS order.

PiperOrigin-RevId: 184429818

6 years ago[tf-signal] Fix exception when input shape is unknown in mfccs_from_log_mel_spectrograms.
RJ Ryan [Sat, 3 Feb 2018 17:46:31 +0000 (09:46 -0800)]
[tf-signal] Fix exception when input shape is unknown in mfccs_from_log_mel_spectrograms.

PiperOrigin-RevId: 184400783

6 years ago[XLA] Add tests for Clamp with scalars S32 and U32.
A. Unique TensorFlower [Sat, 3 Feb 2018 07:02:16 +0000 (23:02 -0800)]
[XLA] Add tests for Clamp with scalars S32 and U32.

PiperOrigin-RevId: 184376425

6 years agoFix breakage: Can't build TFLite with Bazel for Mac / iOS.
Yu-Cheng Ling [Sat, 3 Feb 2018 06:39:45 +0000 (22:39 -0800)]
Fix breakage: Can't build TFLite with Bazel for Mac / iOS.

PiperOrigin-RevId: 184375534

6 years agoA more efficient implementation of the Op using batch operations.
A. Unique TensorFlower [Sat, 3 Feb 2018 03:40:30 +0000 (19:40 -0800)]
A more efficient implementation of the Op using batch operations.

PiperOrigin-RevId: 184367562

6 years agoExtended TFE_OpSetDevice() with the ability to set an op device from non-GPU back...
Mingsheng Hong [Sat, 3 Feb 2018 03:10:39 +0000 (19:10 -0800)]
Extended TFE_OpSetDevice() with the ability to set an op device from non-GPU back to GPU.

Added unit testing, and also refined unit test logic for checking the presence
of a GPU device. The latter is needed when we add XLA device support.

PiperOrigin-RevId: 184366172

6 years ago[XLA] Minor cleanups related to multi-output fusion.
Justin Lebar [Sat, 3 Feb 2018 02:57:10 +0000 (18:57 -0800)]
[XLA] Minor cleanups related to multi-output fusion.

- Add some comments about preexisting invariants, and add some CHECKs.

- In the LoopEmitter constructor, materialize the given
  ArraySlice<IrArray> to a vector, so we don't rely on the given
  ArraySlice having any particular lifetime.

- Add the invariant that the LoopEmitter constructor which takes a
  list of IrArrays is only for multi-output fusion.  Previously it said:
  If you only pass one array, then treat it as regular fusion.  But this
  results in an LLVM type mismatch, because the given
  target_element_generator should be passing a struct with one element.

PiperOrigin-RevId: 184365310

6 years agoPropagate outfeed sharding, if specified from TensorFlow.
A. Unique TensorFlower [Sat, 3 Feb 2018 02:03:11 +0000 (18:03 -0800)]
Propagate outfeed sharding, if specified from TensorFlow.

PiperOrigin-RevId: 184361221

6 years agoAutomated g4 rollback of changelist 184347012
Anna R [Sat, 3 Feb 2018 01:59:16 +0000 (17:59 -0800)]
Automated g4 rollback of changelist 184347012

PiperOrigin-RevId: 184360818

6 years ago[tf.data] Add public header "tensorflow/core/framework/dataset.h".
Derek Murray [Sat, 3 Feb 2018 01:09:59 +0000 (17:09 -0800)]
[tf.data] Add public header "tensorflow/core/framework/dataset.h".

This adds the ability to create a custom C++ Dataset implementation
without linking it statically into the TensorFlow library.  Note that
this internal API is experimental and subject to change between
versions of TensorFlow.

Fixes #16682.

PiperOrigin-RevId: 184356318

6 years agoCheck that the type of an implicitly dereferenced tensor matches the expected input...
Derek Murray [Sat, 3 Feb 2018 01:09:16 +0000 (17:09 -0800)]
Check that the type of an implicitly dereferenced tensor matches the expected input type.

The dtype of a tensor reference can change between the point when it is "produced" by an
operation and consumed by the next operation. This evades checks in the executor that the
type of tensor on each edge matches the type signatures of the producing and consuming operation, which could lead to undefined behavior. Although there is no existing operation that changes the type of a tensor reference, it is possible to use the OpKernelContext API to do so, so we add a further check in the runtime to defend against operations that might be added in the future.

PiperOrigin-RevId: 184356242

6 years agoUpdate global_step by default if the user specifies a host_call.
Jonathan Hseu [Sat, 3 Feb 2018 00:35:10 +0000 (16:35 -0800)]
Update global_step by default if the user specifies a host_call.

PiperOrigin-RevId: 184352399

6 years agoTpu cluster resolver only returns TF server addresses for 'HEALTHY' tpu nodes.
A. Unique TensorFlower [Sat, 3 Feb 2018 00:18:59 +0000 (16:18 -0800)]
Tpu cluster resolver only returns TF server addresses for 'HEALTHY' tpu nodes.

PiperOrigin-RevId: 184350480

6 years agoReplacing _container_prefix with _graph_key to preserve its use in optimizer and...
Alexandre Passos [Sat, 3 Feb 2018 00:02:22 +0000 (16:02 -0800)]
Replacing _container_prefix with _graph_key to preserve its use in optimizer and deprecate others.

PiperOrigin-RevId: 184348303

6 years agoTF_CALL_ALL_TYPES should include variant
Alexandre Passos [Fri, 2 Feb 2018 23:52:18 +0000 (15:52 -0800)]
TF_CALL_ALL_TYPES should include variant

PiperOrigin-RevId: 184347081

6 years agoRollback of recent changes to tensor.{h,cc}
Alexandre Passos [Fri, 2 Feb 2018 23:51:41 +0000 (15:51 -0800)]
Rollback of recent changes to tensor.{h,cc}

PiperOrigin-RevId: 184347012

6 years agoAdds batch inference support on TPU with TPUEstimator.predict.
Jianwei Xie [Fri, 2 Feb 2018 23:00:17 +0000 (15:00 -0800)]
Adds batch inference support on TPU with TPUEstimator.predict.

PiperOrigin-RevId: 184339842

6 years ago[TF RNN] Small optimization to rnn: only calculate copy_cond once.
Eugene Brevdo [Fri, 2 Feb 2018 22:30:50 +0000 (14:30 -0800)]
[TF RNN] Small optimization to rnn: only calculate copy_cond once.

PiperOrigin-RevId: 184335231

6 years agoChanged minimal required version of bleach Python package from 1.5 to 2.0. bleach...
Tatiana Shpeisman [Fri, 2 Feb 2018 22:14:13 +0000 (14:14 -0800)]
Changed minimal required version of bleach Python package from 1.5 to 2.0. bleach 1.5 causes problems with Jupyter as reported in #16424

PiperOrigin-RevId: 184332663

6 years agoA few misc tweaks to TFE APIs.
Mingsheng Hong [Fri, 2 Feb 2018 21:53:08 +0000 (13:53 -0800)]
A few misc tweaks to TFE APIs.

PiperOrigin-RevId: 184329345

6 years agoTFLite: Conv CBLAS kernel
Yu-Cheng Ling [Fri, 2 Feb 2018 21:49:35 +0000 (13:49 -0800)]
TFLite: Conv CBLAS kernel
PiperOrigin-RevId: 184328848

6 years ago[tf.data] Move framework/dataset.h to framework/dataset_stateful_op_whitelist.h.
Derek Murray [Fri, 2 Feb 2018 21:39:38 +0000 (13:39 -0800)]
[tf.data] Move framework/dataset.h to framework/dataset_stateful_op_whitelist.h.

This will make way for the move of kernels/data/dataset.h to
framework/dataset.h, while preserving version control history, after
which we might recombine the headers.

PiperOrigin-RevId: 184327481

6 years agoSupport `float16` `dtype` in `tf.linalg.*`.
Joshua V. Dillon [Fri, 2 Feb 2018 21:08:31 +0000 (13:08 -0800)]
Support `float16` `dtype` in `tf.linalg.*`.
Note: not all `LinearOperator` functions will support `float16`. This change
merely enables constructing the `LinearOperator` object(s) using this `dtype`.

PiperOrigin-RevId: 184323477

6 years agoBreaking change: Revise HMC interface to accept a list of Tensors representing a...
Joshua V. Dillon [Fri, 2 Feb 2018 21:07:37 +0000 (13:07 -0800)]
Breaking change: Revise HMC interface to accept a list of Tensors representing a partitioning of chain state.

PiperOrigin-RevId: 184323369

6 years agoSkip the node that has unexpected number of outputs.
Yuefeng Zhou [Fri, 2 Feb 2018 20:46:34 +0000 (12:46 -0800)]
Skip the node that has unexpected number of outputs.

PiperOrigin-RevId: 184320865

6 years ago[TF:XLA] Bump open source llvm revision to r324073
Sanjoy Das [Fri, 2 Feb 2018 20:23:47 +0000 (12:23 -0800)]
[TF:XLA] Bump open source llvm revision to r324073

PiperOrigin-RevId: 184318036

6 years agoUpdate ops-related pbtxt files.
A. Unique TensorFlower [Fri, 2 Feb 2018 20:19:43 +0000 (12:19 -0800)]
Update ops-related pbtxt files.

PiperOrigin-RevId: 184317521

6 years ago[TF:XLA] Improve/refactor the handling of resource types/shapes.
Peter Hawkins [Fri, 2 Feb 2018 19:31:06 +0000 (11:31 -0800)]
[TF:XLA] Improve/refactor the handling of resource types/shapes.

Previously we used an xla::Shape to track the shape of a resource (Variable, TensorArray, Stack) shape. The xla::Shape described how the resource was represented to XLA, e.g., as a (buffer, size) pair for a Stack resource.

Instead, separate the TensorFlow abstract shape representation from the XLA shape representation and track it separately. This leads to simpler and more readable code.

PiperOrigin-RevId: 184310694

6 years agoAllow ResizeBilinear to resize the output tensor in Prepare(), if the size tensor...
A. Unique TensorFlower [Fri, 2 Feb 2018 19:24:17 +0000 (11:24 -0800)]
Allow ResizeBilinear to resize the output tensor in Prepare(), if the size tensor is const.

PiperOrigin-RevId: 184309687

6 years agoRegister resource_scatter_update for string types.
Alexandre Passos [Fri, 2 Feb 2018 19:24:11 +0000 (11:24 -0800)]
Register resource_scatter_update for string types.

PiperOrigin-RevId: 184309674

6 years agoAdd shape inference for outside_compilation graph rewrite. Pull out enough of the...
A. Unique TensorFlower [Fri, 2 Feb 2018 19:06:09 +0000 (11:06 -0800)]
Add shape inference for outside_compilation graph rewrite. Pull out enough of the graph to enable inference of the shape of a SendFromHost Op once the shape of corresponding RecvAtHost Ops are known.
END_PUBLIC

Fixed open source build breaks.

BEGIN_PUBLIC
Automated g4 rollback of changelist 184169668

PiperOrigin-RevId: 184306845

6 years agoRegister GPU host kernels for Identity and RefIdentity.
A. Unique TensorFlower [Fri, 2 Feb 2018 18:58:12 +0000 (10:58 -0800)]
Register GPU host kernels for Identity and RefIdentity.

PiperOrigin-RevId: 184305574

6 years agoAutomated g4 rollback of changelist 184273245
A. Unique TensorFlower [Fri, 2 Feb 2018 18:46:34 +0000 (10:46 -0800)]
Automated g4 rollback of changelist 184273245

PiperOrigin-RevId: 184303789

6 years agoRemove hidden_ops.txt file. Instead, switch to use visibility attribute in ApiDef...
Anna R [Fri, 2 Feb 2018 18:28:20 +0000 (10:28 -0800)]
Remove hidden_ops.txt file. Instead, switch to use visibility attribute in ApiDef proto.

PiperOrigin-RevId: 184301076

6 years agoConsider beyond immediate neighbors to find exit node.
Jacques Pienaar [Fri, 2 Feb 2018 18:04:15 +0000 (10:04 -0800)]
Consider beyond immediate neighbors to find exit node.

Most of the exit nodes are immediate neighbors of the switch, except we do have
cases where the switch feeds into an identity that feeds into a exit.

PiperOrigin-RevId: 184297180

6 years agoShow that we must over reallocate after resizing dynamic tensors.
A. Unique TensorFlower [Fri, 2 Feb 2018 18:01:40 +0000 (10:01 -0800)]
Show that we must over reallocate after resizing dynamic tensors.

PiperOrigin-RevId: 184296680

6 years agoFix latent bug in dependency optimizer.
A. Unique TensorFlower [Fri, 2 Feb 2018 17:20:26 +0000 (09:20 -0800)]
Fix latent bug in dependency optimizer.

PiperOrigin-RevId: 184291701

6 years agoDisable graph optimizations (CSE) in test so that constant nodes are not deduped.
Yao Zhang [Fri, 2 Feb 2018 17:00:41 +0000 (09:00 -0800)]
Disable graph optimizations (CSE) in test so that constant nodes are not deduped.

PiperOrigin-RevId: 184289685

6 years ago[comment-only change]: Fix grammar error.
A. Unique TensorFlower [Fri, 2 Feb 2018 16:09:48 +0000 (08:09 -0800)]
[comment-only change]: Fix grammar error.

PiperOrigin-RevId: 184285125

6 years agoFix a bug in function inlining when the argument is an implicitly dereferenced ref...
Derek Murray [Fri, 2 Feb 2018 16:09:13 +0000 (08:09 -0800)]
Fix a bug in function inlining when the argument is an implicitly dereferenced ref tensor.

Previously the inliner would add an identity node with an invalid ref-type attr when the actual parameter had ref type. The changed version removes the reference.

PiperOrigin-RevId: 184285084

6 years agoEnabling partitioned variables to work with TPU.
A. Unique TensorFlower [Fri, 2 Feb 2018 13:38:50 +0000 (05:38 -0800)]
Enabling partitioned variables to work with TPU.
When partitioned variables are used in a TPU training loop,
concat gradient operations get generated for which XLA requires
the concat dimension argument to be a constant (or foldable to a constant).
However since such constant is defined outside of the train while context
an Enter node is generated in order to pass it.
The fix consists in detecting such case, and to duplicate the (scalar) constant
inside the while context, so that XLA can succesfully process the resulting
graph.

PiperOrigin-RevId: 184273245

6 years agoFix some tf-lite tests
Gunhan Gulsoy [Fri, 2 Feb 2018 07:47:33 +0000 (23:47 -0800)]
Fix some tf-lite tests

PiperOrigin-RevId: 184247187

6 years agoFix tolerance too tight for Wasserstein distance test.
A. Unique TensorFlower [Fri, 2 Feb 2018 05:43:12 +0000 (21:43 -0800)]
Fix tolerance too tight for Wasserstein distance test.

PiperOrigin-RevId: 184240222

6 years agoFix some tf-lite tests
Gunhan Gulsoy [Fri, 2 Feb 2018 07:47:33 +0000 (23:47 -0800)]
Fix some tf-lite tests

PiperOrigin-RevId: 184247187

6 years agoFix tolerance too tight for Wasserstein distance test.
A. Unique TensorFlower [Fri, 2 Feb 2018 05:43:12 +0000 (21:43 -0800)]
Fix tolerance too tight for Wasserstein distance test.

PiperOrigin-RevId: 184240222

6 years agoInternal change
Justin Lebar [Fri, 2 Feb 2018 05:34:18 +0000 (21:34 -0800)]
Internal change

PiperOrigin-RevId: 184239740

6 years agoAutomated g4 rollback of changelist 183874527
A. Unique TensorFlower [Fri, 2 Feb 2018 04:35:29 +0000 (20:35 -0800)]
Automated g4 rollback of changelist 183874527

PiperOrigin-RevId: 184236409

6 years agoSupporting new saving op structure.
A. Unique TensorFlower [Fri, 2 Feb 2018 03:50:34 +0000 (19:50 -0800)]
Supporting new saving op structure.

PiperOrigin-RevId: 184233513

6 years agoAdd darwin_x86_64 config in TF Lite BUILD file.
Yu-Cheng Ling [Fri, 2 Feb 2018 02:27:31 +0000 (18:27 -0800)]
Add darwin_x86_64 config in TF Lite BUILD file.

PiperOrigin-RevId: 184227786

6 years agoFixed the description of the fake GPU device to avoid a division by 0
Benoit Steiner [Fri, 2 Feb 2018 02:05:15 +0000 (18:05 -0800)]
Fixed the description of the fake GPU device to avoid a division by 0

PiperOrigin-RevId: 184225409

6 years agoFix tests
Brennan Saeta [Fri, 2 Feb 2018 01:20:11 +0000 (17:20 -0800)]
Fix tests

PiperOrigin-RevId: 184220615

6 years agoSkip unknown devices since we can't optimize for them
Benoit Steiner [Fri, 2 Feb 2018 01:19:32 +0000 (17:19 -0800)]
Skip unknown devices since we can't optimize for them

PiperOrigin-RevId: 184220515

6 years agoAllow reordering of execution order of nodes with indirect execution_plan.
Andrew Selle [Fri, 2 Feb 2018 00:51:59 +0000 (16:51 -0800)]
Allow reordering of execution order of nodes with indirect execution_plan.

Now whenever we want to operate in dependency order we use execution_plan.
It begins as identity map (0, ..., nodes_size()) but can be changed
in the future. This is the basis for more pluggable delegation.

PiperOrigin-RevId: 184216885

6 years agoAutomated g4 rollback of changelist 184188816
Jacques Pienaar [Fri, 2 Feb 2018 00:29:30 +0000 (16:29 -0800)]
Automated g4 rollback of changelist 184188816

PiperOrigin-RevId: 184213576

6 years agoGCS Throttle: 1 token == 1 Kb
Brennan Saeta [Fri, 2 Feb 2018 00:22:24 +0000 (16:22 -0800)]
GCS Throttle: 1 token == 1 Kb

Previously, 1 token was approximately 256 bytes. This is slightly less
intuitive than 1 kb.

PiperOrigin-RevId: 184212503

6 years agoAdd functionality to fold batch norm (supporting both fused and unfused batch norm...
Raghuraman Krishnamoorthi [Fri, 2 Feb 2018 00:14:51 +0000 (16:14 -0800)]
Add functionality to fold batch norm (supporting both fused and unfused batch norm) to support quantized training. The weights are always now scaled by gamma/sigma, where sigma is the moving standard deviation for stability prior to quantization.  For improved performance, the moving means and variances are frozen and the training graph modified accordingly.

An additional parameter freeze_batch_norm_delay is added to foldbatchnorm function to set the delay at which training switches from regular batch norm to frozen mean and variances.

Remove placement options within FoldBatchNorm as this causes folded training to place all ops on a single GPU. The modification now significantly speeds up distributed training.

The tests for folding batch norms are also updated to reflect the additional topological changes to the graph.

PiperOrigin-RevId: 184211434