platform/upstream/tensorflow.git
6 years agoFix warning about keep_dims. keep_dims -> keepdims for tf.reduce_sum(). (#16876)
Yukun Chen [Mon, 12 Feb 2018 07:05:37 +0000 (02:05 -0500)]
Fix warning about keep_dims. keep_dims -> keepdims for tf.reduce_sum(). (#16876)

* Fix warning about keep_dims. keep_dims -> keepdims for tf.reduce_sum().

* fix test failure.

6 years agoImprove formatting of shapes in tf.losses documentation (#16921)
Christopher Yeh [Mon, 12 Feb 2018 07:05:17 +0000 (23:05 -0800)]
Improve formatting of shapes in tf.losses documentation (#16921)

6 years agoCMAKE: optionally link to ZLIB as systemlib / shared objects. (#15382)
MyungJoo Ham [Mon, 12 Feb 2018 07:04:43 +0000 (16:04 +0900)]
CMAKE: optionally link to ZLIB as systemlib / shared objects. (#15382)

If the user has ZLIB (and devel pkg) installed at the system
and the user wants to keep using that ZLIB for tensorflow,
the cmake option "-Dsystemlib_ZLIB=ON" will allow to do so.

Another option "-Dsystemlib_ALL=ON" will turn on every
"systemlib_*" options.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
6 years agotypo fix (#16903)
DylanDmitri [Sun, 11 Feb 2018 03:17:13 +0000 (21:17 -0600)]
typo fix (#16903)

Copied the new description from docstring on line 37. Used the phrase "spectogram timeslice" rather than "frequency window" for consistency with the tooltip on ```--window_size_ms```.

6 years agoFix typo (#16908)
ManHyuk [Sun, 11 Feb 2018 03:17:00 +0000 (12:17 +0900)]
Fix typo (#16908)

* fit typo

* fix typo

6 years ago[MSVC] Workaround MSVC template/lambda parsing bug (#16904)
Loo Rong Jie [Sun, 11 Feb 2018 03:16:47 +0000 (11:16 +0800)]
[MSVC] Workaround MSVC template/lambda parsing bug (#16904)

6 years agoFix the profiler python docstring link (#16916)
Yong Tang [Sun, 11 Feb 2018 03:15:12 +0000 (19:15 -0800)]
Fix the profiler python docstring link (#16916)

This fix fixes the python docstring link of the profiler:
`profilerg3doc` -> `profiler/g3doc`

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
6 years agoAdd S3 plugin to the list of file system plugin in doc (add_filesys.md) (#16920)
Yong Tang [Sun, 11 Feb 2018 03:14:41 +0000 (19:14 -0800)]
Add S3 plugin to the list of file system plugin in doc (add_filesys.md) (#16920)

This fix adds S3 plugin to the list of file system plugin in
doc (add_filesys.md).

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
6 years agoImprove shape function of NonMaxSuppression (#16890)
Yong Tang [Sat, 10 Feb 2018 12:00:39 +0000 (04:00 -0800)]
Improve shape function of NonMaxSuppression (#16890)

* Improve shape function of NonMaxSuppression

In the docs for `tf.image.non_max_suppression`, the shapes
of the args `boxes` and `scores` are `[num_boxes, 4]` and `[num_boxes]`
respectively.

This fix improve the shape function of NonMaxSuppression so that
`boxes_shape[0] = scores_shape[0] = num_boxes`.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Add additional test case for shape function of NonMaxSuppression

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
6 years agoMerge pull request #16858 from case540/branch_184929151
Michael Case [Fri, 9 Feb 2018 23:16:01 +0000 (15:16 -0800)]
Merge pull request #16858 from case540/branch_184929151

Branch 184929151

6 years agoMerge branch 'master' into branch_184929151
Michael Case [Thu, 8 Feb 2018 21:22:26 +0000 (13:22 -0800)]
Merge branch 'master' into branch_184929151

6 years agoFix pylint issues.
Michael Case [Thu, 8 Feb 2018 21:10:23 +0000 (13:10 -0800)]
Fix pylint issues.

6 years agoMerge pull request #16874 from jhseu/revert
Jonathan Hseu [Thu, 8 Feb 2018 20:32:40 +0000 (12:32 -0800)]
Merge pull request #16874 from jhseu/revert

Revert "Fix missing . (#16460)"

6 years agoRevert "Fix missing . (#16460)"
Jonathan Hseu [Thu, 8 Feb 2018 20:30:53 +0000 (12:30 -0800)]
Revert "Fix missing . (#16460)"

This reverts commit 5e23338fec26f0c5ad588742b8df80e5bf1a940d.

6 years agoFix missing . (#16460)
matthieudelaro [Thu, 8 Feb 2018 20:17:37 +0000 (21:17 +0100)]
Fix missing . (#16460)

6 years agofix typo (#16812)
Johnson145 [Thu, 8 Feb 2018 20:16:52 +0000 (21:16 +0100)]
fix typo (#16812)

6 years agoMove some ndlstm functions to contrib (#16816)
Jerome [Thu, 8 Feb 2018 20:16:38 +0000 (04:16 +0800)]
Move some ndlstm functions to contrib (#16816)

* Added ctc_loss_dense_labels. This does the conversion of dense labels into sparse ones to be passed into the core ctc_loss function.

* Removed constant_op from the import.

* Matched ctc_loss_dense_labels with the other layers ops.

* Added ctc_loss_dense_labels to contrib.layers __init__.py file

* Added missing comma to list of ops.

* Reordred arguments for ctc_loss_dense_labels

Labels should be first then inputs for ctc_loss.

* Removed ctc_loss_dense_labels.

Replaced it with dense_to_sparse instead so that there'll be only one ctc_loss function.

* Replaced ctc_loss_dense_labels with dense_to_sparse

* Fixed dense_to_sparse. Some of the names of the variables did not match with that of the parameters.

* Updated documentation for dense_to_sparse since it can accept a tensor of any shape.

* Added test case for dense_to_sparse.

* Updated documentation. Dense to sparse accepts int tensors.

* Fixed testDenseFromConstantToSparse.

The sparse_to_dense order of arguments in the test are wrong and the expected constant should be of int64.

* Modified implementation of ndlstm_base_dynamic.

It now uses a BasicLSTMCell that has state_is_tuple=True to address deprecation. Right now it is still unknown why it was set to false in the first place.

* Imported lstm1d and lstm2d in ndlstm __init__.py.

Makes importing ndlstm modules easier.

* Added testGetBlocks in lstm2d_test.

* Removed testGetBlocks.py

* Modified lstm1d.ndlstm_base_unrolled to use lstm_cell with state_is_tuple = True.

* Copied some lstm2d.py functions in ndlstm module to contrib.layers.

* Update lstm1d.py

Reverted changes made.

* Update layers_test.py

Fixed failing test.

* Modified layers.py and layers_test.py.

Made them pass pylint tests.

6 years agoFix two links. (#16854)
Liang-Chi Hsieh [Thu, 8 Feb 2018 19:32:10 +0000 (04:32 +0900)]
Fix two links. (#16854)

6 years agoremove keep_dims warning in maxout layer (#16769)
Haichen "HC" Li [Thu, 8 Feb 2018 18:55:47 +0000 (13:55 -0500)]
remove keep_dims warning in maxout layer (#16769)

6 years agoFixing assert message for beta distribution (#16786)
lazypanda1 [Thu, 8 Feb 2018 18:54:57 +0000 (12:54 -0600)]
Fixing assert message for beta distribution (#16786)

6 years agopython 2.7 unit test error repair on windows (#16725)
fo40225 [Thu, 8 Feb 2018 18:54:31 +0000 (02:54 +0800)]
python 2.7 unit test error repair on windows (#16725)

* python 2.7 unit test error repair on windows

* Fix lint error.

6 years agoAdd option to not include histograms (#16579)
Ben [Thu, 8 Feb 2018 18:49:23 +0000 (13:49 -0500)]
Add option to not include histograms (#16579)

* Add option to not include histograms

* Add test for model_summaries=False

6 years agoAdds parameter 'msg' to tf.TensorFlowTestCase. (#16667)
Phil [Thu, 8 Feb 2018 18:48:42 +0000 (19:48 +0100)]
Adds parameter 'msg' to tf.TensorFlowTestCase. (#16667)

This commit adds a msg parameter that defaults to None to the following
functions:
- assertProtoEquals
- assertArrayNear
- assertNDArrayNear
- assertAllClose
- assertAllEqual
- assertShapeEqual
- assertDeviceEqual

6 years agoFixes variable name (#16797)
Rajendra arora [Thu, 8 Feb 2018 18:48:19 +0000 (00:18 +0530)]
Fixes variable name (#16797)

* Fixes variable typo name

* fixes optional typo

* Fix typo

* fixes deallocations

* typo fix

* typo fix

* fixes variable name

* fixes param typo

* Fixes typo

* fix typo

* fixes

6 years agoUpdate CONTRIBUTING.md (#16806)
Brad Wannow [Thu, 8 Feb 2018 18:47:34 +0000 (12:47 -0600)]
Update CONTRIBUTING.md (#16806)

* Update CONTRIBUTING.md

Edited a few grammar issues.

* Fix

6 years agoFix error message in record_reader (#16808)
Glenn Weidner [Thu, 8 Feb 2018 18:46:12 +0000 (10:46 -0800)]
Fix error message in record_reader (#16808)

6 years agoMake configure script more lenient to the length of CUDA and cuDNN versions entered...
Gunhan Gulsoy [Thu, 8 Feb 2018 18:45:37 +0000 (10:45 -0800)]
Make configure script more lenient to the length of CUDA and cuDNN versions entered. (#16853)

6 years agoImprove shape function of SampleDistortedBoundingBox and fix some test cases (#16870)
Yong Tang [Thu, 8 Feb 2018 18:41:03 +0000 (10:41 -0800)]
Improve shape function of SampleDistortedBoundingBox and fix some test cases (#16870)

* Update test case to expose the issue of sample_distorted_bounding_box

This commit expoes the issue of sample_distorted_bounding_box,
as shape function does not check the ranking like inside Compute().

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Adjust shape to pass the test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Improve shape function of SampleDistortedBoundingBox and fix some test cases

This fix tries to improve the shape function of SampleDistortedBoundingBox
and fix several test case issues.
As is shown in the kernel of SampleDistortedBoundingBox, the shape of
SampleDistortedBoundingBox are required to be 1-D `[height, width, channels]`
for image_size, 3-D with shape `[batch, N, 4]` for bounding_boxes.

In the test case, the uses shape is incorrect but becasue of no check in shape
function, the test case passes.

This fix adds the shape check for SampleDistortedBoundingBox, and
fixes the incorrect test cases.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
6 years agoFix broken link in CONTRIBUTING.md (#16869)
Yong Tang [Thu, 8 Feb 2018 18:35:08 +0000 (10:35 -0800)]
Fix broken link in CONTRIBUTING.md (#16869)

This fix fixes the broken link in CONTRIBUTING.md.
Without `https://`, the markdown will render the link incorrectly to
https://github.com/tensorflow/tensorflow/blob/master/www.docker.com

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
6 years agoFix static shape inference for keras.layers.LSTM (#15234)
Yan Facai (颜发才) [Thu, 8 Feb 2018 16:59:08 +0000 (00:59 +0800)]
Fix static shape inference for keras.layers.LSTM (#15234)

* TST: add test case

* BUG: fix static shape inference

* TST: clean code

* BUG: support dims > 3

6 years agoEnable some passes for graph_transform on Windows (#16121)
Scott Tseng [Thu, 8 Feb 2018 16:58:36 +0000 (00:58 +0800)]
Enable some passes for graph_transform on Windows (#16121)

* Enable some passes for graph_transform on Windows

Don't know why but the following passes are disabled on Windows:

* quantize_weights
* quantize_nodes
* round_weights

This patch re-enabled them.

* Fix BUILD file in response to format checker

6 years agopy_func convert unicode string results to bytes for python2 (#16322)
Yan Facai (颜发才) [Thu, 8 Feb 2018 16:54:08 +0000 (00:54 +0800)]
py_func convert unicode string results to bytes for python2 (#16322)

* TST: add test case

* BUG: allow unicode string for python 2

* DOC: revise doc

* Fix lint error

6 years agoMerge commit for internal changes
Michael Case [Thu, 8 Feb 2018 08:57:18 +0000 (00:57 -0800)]
Merge commit for internal changes

6 years agoReduce the number of concats to avoid test timeout.
Yao Zhang [Thu, 8 Feb 2018 02:11:51 +0000 (18:11 -0800)]
Reduce the number of concats to avoid test timeout.

PiperOrigin-RevId: 184929151

6 years agoRemove note about accumulator variables, since those are not added to TRAINABLE_VARIA...
A. Unique TensorFlower [Thu, 8 Feb 2018 01:16:32 +0000 (17:16 -0800)]
Remove note about accumulator variables, since those are not added to TRAINABLE_VARIABLES.

PiperOrigin-RevId: 184922273

6 years agoAdd operation to forward log messages from remote workers to a local system.
Russell Power [Thu, 8 Feb 2018 01:12:01 +0000 (17:12 -0800)]
Add operation to forward log messages from remote workers to a local system.

PiperOrigin-RevId: 184921657

6 years ago[XLA:CPU] Fix test case for vectorized Exp and Tanh to actually vectorize
Sanjoy Das [Thu, 8 Feb 2018 00:48:45 +0000 (16:48 -0800)]
[XLA:CPU] Fix test case for vectorized Exp and Tanh to actually vectorize

I just noticed that the test case for ArrayElementwiseOpTest::ExpF32sVector and
possibly for ArrayElementwiseOpTest::ExpF32sVector does not actually vectorize
the intrinsic calls.  This is most likely a very recent regression because I
remember fixing at least one issue in the emitter demonstrated by the test.
Despite that I think the current approach is better since we have unit tests
that check that we at least vectorize the vector-of-F32's case.

PiperOrigin-RevId: 184918373

6 years agoAdd optimized gif support for decode_gif (#16804)
Yong Tang [Thu, 8 Feb 2018 00:48:21 +0000 (16:48 -0800)]
Add optimized gif support for decode_gif (#16804)

* Add optimized gif support for decode_gif

While revisiting the issue of 15838, I noticed that
currently optimized gif is not supported. However,
optimized gif is actually possible to be processed
as essentially the subsequent frame just adds
the content on top of the previous frame on canvas.

This fix adds the support for optimized gif with decode_gif.

As is shown in the added test case, optimized gif (`optimized.gif`)
could be handled the same way as original gif (`scan.gif`).

This fix fixes 15838.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Format gif_io.cc with clang-format -i --style=Google

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Add test case to cover optimized gif support for decode_gif.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Add `#include <algorithm>` to fix Windows build errors

This commit add `#include <algorithm>` to fix
build errors on Windows platform.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
6 years agoAdd uint32 and uint64 kernel support for `Invert` (#15154)
Yong Tang [Thu, 8 Feb 2018 00:48:00 +0000 (16:48 -0800)]
Add uint32 and uint64 kernel support for `Invert` (#15154)

* Add uint32 and uint64 kernel support for `Invert`

This fix adds uint32 and uint64 kernel support for `Invert`.

In bitwise_ops.cc, uint32 and uint64 have been registered
for `Invert` like other bitwise ops
`BitwiseAnd`/`BitwiseOr`/`BitwiseXor`/`LeftShift`/`RightShift`.
However, no uint32 and uint64 kernels available for `Invert` yet.

This fix add uint32 and uint64 kernel for `Invert`,
and adds additional test cases to cover the changes.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Add test cases for uint32 and uint64 support with `Invert`

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Add missing uint32 and uint64 in GPU for invert

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Add DEFINE_UNARY8 for invert

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
6 years agoSupport CopyFile with streaming (#12658)
Yong Tang [Thu, 8 Feb 2018 00:46:31 +0000 (16:46 -0800)]
Support CopyFile with streaming (#12658)

* Support CopyFile with streaming

This fix tries to address the issue raised in 12641 where
it was not possible to have CopyFile with streaming. The original
implementation copies the whole content of the file to a string
buffer and write to the file. This could be an issue
if the file size is large (than memory of the host).

This fix streams the CopyFile operation.

This fix fixes 12641.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Use sendfile for CopyFile implementation in Linux

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Merge CopyFile for same fs and different fs

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* `sendfile64` -> `sendfile` to fix Android build

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Add sendfile processing for Darwin

This commit adds sendfile processing for OSX Darwin.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Not using sendfile in MacOSX

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Address review feedback

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Remove the size check and test OUT_OF_RANGE instead.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Small fixes

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Rename CopyFile to FileSystemCopyFile to fix Windows build errors

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
6 years agoUpdate ops-related pbtxt files.
A. Unique TensorFlower [Thu, 8 Feb 2018 00:34:57 +0000 (16:34 -0800)]
Update ops-related pbtxt files.

PiperOrigin-RevId: 184916250

6 years agoresolve undefined name array_ops (#16485)
cclauss [Thu, 8 Feb 2018 00:35:29 +0000 (01:35 +0100)]
resolve undefined name array_ops (#16485)

6 years agoDisable internally failing array_ops test.
Michael Case [Thu, 8 Feb 2018 00:26:55 +0000 (16:26 -0800)]
Disable internally failing array_ops test.

PiperOrigin-RevId: 184915141

6 years agoFix document typo (#16489)
Yusuke Yamada [Thu, 8 Feb 2018 00:35:13 +0000 (09:35 +0900)]
Fix document typo (#16489)

6 years agoRemove tf.contrib.ndlstm as it is not maintained and barely used.
Eugene Brevdo [Thu, 8 Feb 2018 00:24:34 +0000 (16:24 -0800)]
Remove tf.contrib.ndlstm as it is not maintained and barely used.

Users can find an external implementation by the original author at:

https://github.com/tmbarchive/tfndlstm

PiperOrigin-RevId: 184914822

6 years agoFix undefined name: import as_str_any for line 35 (#16668)
cclauss [Thu, 8 Feb 2018 00:28:06 +0000 (01:28 +0100)]
Fix undefined name: import as_str_any for line 35 (#16668)

flake8 testing of https://github.com/tensorflow/tensorflow on Python 2.7.14

$ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__
```
./tensorflow/python/util/compat_internal.py:33:12: F821 undefined name 'as_str_any'
    path = as_str_any(path.__fspath__())
           ^
```

6 years agoFixed a typo in `group_by_window` documentation (#16711)
Sergei Lebedev [Thu, 8 Feb 2018 00:26:36 +0000 (01:26 +0100)]
Fixed a typo in `group_by_window` documentation (#16711)

6 years agoCMake (Windows): Added support for ninja build and some fixes/changes (#16763)
Marcus Ong [Thu, 8 Feb 2018 00:25:49 +0000 (18:25 -0600)]
CMake (Windows): Added support for ninja build and some fixes/changes (#16763)

* Added support for ninja build and some fixes/changes in CMake for Windows

* Fixed typo

6 years agospelling fixes for contrib docs (#16811)
brett koonce [Thu, 8 Feb 2018 00:21:31 +0000 (16:21 -0800)]
spelling fixes for contrib docs (#16811)

6 years agoRemove obsolete BernoulliWithSigmoidProbs (#16846)
Yong Tang [Thu, 8 Feb 2018 00:21:13 +0000 (16:21 -0800)]
Remove obsolete BernoulliWithSigmoidProbs (#16846)

As was pointed out by 9485, BernoulliWithSigmoidProbs is covered
by Bernoulli and is obsolete. This fix removes BernoulliWithSigmoidProbs.

This fix closes 9485.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
6 years agoFix typo (#16822)
hsm207 [Thu, 8 Feb 2018 00:20:15 +0000 (19:20 -0500)]
Fix typo (#16822)

6 years agoMerge pull request #16837 from yongtang/16534-tf.losses.softmax_cross_entropy
Martin Wicke [Thu, 8 Feb 2018 00:14:23 +0000 (16:14 -0800)]
Merge pull request #16837 from yongtang/16534-tf.losses.softmax_cross_entropy

Remove warnings in tf.losses.softmax_cross_entropy

6 years agoGo: Update generated wrapper functions for TensorFlow ops.
A. Unique TensorFlower [Wed, 7 Feb 2018 23:08:24 +0000 (15:08 -0800)]
Go: Update generated wrapper functions for TensorFlow ops.
PiperOrigin-RevId: 184903402

6 years ago[XLA] Keep the number of HloPasses minimum for the interpreter backend.
Kay Zhu [Wed, 7 Feb 2018 22:51:03 +0000 (14:51 -0800)]
[XLA] Keep the number of HloPasses minimum for the interpreter backend.

This would be useful to identify bugs for these HLO passes.

PiperOrigin-RevId: 184900236

6 years agoMerge changes from github.
Michael Case [Wed, 7 Feb 2018 22:36:00 +0000 (14:36 -0800)]
Merge changes from github.

PiperOrigin-RevId: 184897758

6 years agoFixes issue when linking of rule '//tensorflow/contrib/lite/toco:toco… (#16838)
Francisco Guerrero [Wed, 7 Feb 2018 22:19:25 +0000 (17:19 -0500)]
Fixes issue when linking of rule '//tensorflow/contrib/lite/toco:toco… (#16838)

* Fixes issue when linking of rule '//tensorflow/contrib/lite/toco:toco' fails because LD_LIBRARY_PATH is not configured

* Check if LD_LIBRARY_PATH is in environ_cp

6 years agoBump JetPack default to 3.2 in Android build script (#16842)
Andrew Harp [Wed, 7 Feb 2018 22:19:11 +0000 (17:19 -0500)]
Bump JetPack default to 3.2 in Android build script (#16842)

6 years agoBetter documentation for contrib summaries.
Alexandre Passos [Wed, 7 Feb 2018 22:13:05 +0000 (14:13 -0800)]
Better documentation for contrib summaries.

Also all_summary_ops returns None in eager mode instead of error.

PiperOrigin-RevId: 184893777

6 years agoGeneralize quantization rewrite to not rely on names.
Suharsh Sivakumar [Wed, 7 Feb 2018 21:47:02 +0000 (13:47 -0800)]
Generalize quantization rewrite to not rely on names.

It should now work with most graphs regardless if they were built slim or not.

PiperOrigin-RevId: 184889280

6 years agoChange output of slim.learning.train to total_loss = None, if no training step was...
A. Unique TensorFlower [Wed, 7 Feb 2018 21:46:29 +0000 (13:46 -0800)]
Change output of slim.learning.train to total_loss = None, if no training step was actually performed.

PiperOrigin-RevId: 184889196

6 years ago[tf.data] Move the C++ Dataset class implementations to the framework library.
Derek Murray [Wed, 7 Feb 2018 21:44:30 +0000 (13:44 -0800)]
[tf.data] Move the C++ Dataset class implementations to the framework library.

This enables the use of the `DatasetOpKernel` subclasses in custom op library
code. A subsequent change will move `tf.contrib.data` kernel implementations
to a custom op library.

Implementation note: This change moves some classes from
"tensorflow/core/graph/..." into the framework library, which does not
include any code in "tensorflow/core/common_runtime/...". To break the
dependency from "tensorflow/core/framework/dataset.cc" to
"tensorflow/core/common_runtime/...", the `GraphDefBuilderToGraph()`
method has been split out from the `GraphDefBuilder` class (where it
was previously exposed as the `GraphDefBuilder::ToGraph()` utility
method) and added to a new
"tensorflow/core/graph/graph_def_builder_util.h" module.  This method
depends on ".../graph/graph_constructor.cc", which depends directly on
".../common_runtime/shape_refiner.h" and indirectly on
".../common_runtime/graph_runner.h". Since this method was used only
in tests, these have been updated to point to the new utility method.

PiperOrigin-RevId: 184888903

6 years agoMerge pull request #16844 from rmlarsen/master
Rasmus Munk Larsen [Wed, 7 Feb 2018 21:47:04 +0000 (13:47 -0800)]
Merge pull request #16844 from rmlarsen/master

Fix comparison in neon_depthwise_conv_op test.

6 years agoMakefile flag to use Apple Accelerate for Conv on iOS.
Yu-Cheng Ling [Wed, 7 Feb 2018 21:39:01 +0000 (13:39 -0800)]
Makefile flag to use Apple Accelerate for Conv on iOS.

PiperOrigin-RevId: 184888096

6 years agoMerge pull request #16819 from ankurtaly/branch_184768730
ankurtaly [Wed, 7 Feb 2018 21:17:05 +0000 (13:17 -0800)]
Merge pull request #16819 from ankurtaly/branch_184768730

Branch 184768730

6 years agoFix bug and speed up Grappler constant folding
Rasmus Munk Larsen [Wed, 7 Feb 2018 20:56:06 +0000 (12:56 -0800)]
Fix bug and speed up Grappler constant folding

Fix bug in and speed up ConstantFolding::CreateNodeDef():
  * Fix bug trying to store more than kintmax32 values in a repeated proto field.
  * Speed up populating compressed format. Example: tensorflow/python/kernel_tests/large_concat_op_test with size = 2**29+6 goes from ~30 seconds to ~15 seconds. The fraction of time spent in ConstantFolding::CreateNodeDef() goes down from about 35% to about 12%.

6 years agoUse assertAllClose instead of assertArrayNear.
Rasmus Munk Larsen [Wed, 7 Feb 2018 20:45:39 +0000 (12:45 -0800)]
Use assertAllClose instead of assertArrayNear.

assertArrayNear compares absolute instead of relative error. For floating point computation you want the latter.

6 years agoAdd BatchMatMul support and improve tensorflow graphdef export by adding ops and...
A. Unique TensorFlower [Wed, 7 Feb 2018 20:32:53 +0000 (12:32 -0800)]
Add BatchMatMul support and improve tensorflow graphdef export by adding ops and fixing typing and resolving constant Transpose ops.

PiperOrigin-RevId: 184878663

6 years agoMerge pull request #1 from tensorflow/master
Rasmus Munk Larsen [Wed, 7 Feb 2018 20:37:14 +0000 (12:37 -0800)]
Merge pull request #1 from tensorflow/master

merge from master

6 years agoSet the number of warmup steps for building the cost model.
Yao Zhang [Wed, 7 Feb 2018 20:29:25 +0000 (12:29 -0800)]
Set the number of warmup steps for building the cost model.

PiperOrigin-RevId: 184878186

6 years agoInitial XLA support for TF eager. This is prerequisite for TF compiler's XLA support.
Mingsheng Hong [Wed, 7 Feb 2018 20:22:55 +0000 (12:22 -0800)]
Initial XLA support for TF eager. This is prerequisite for TF compiler's XLA support.

This CL adds XLA support for the following TFE_Op's:

1. A TF op such as MatMul, with full support of constant and resource params.

2. A TF_Function as TFE_Op, where the function must have no constant and
resource params. Removing this restriction requires more discussion and will be
deferred to a later time.

PiperOrigin-RevId: 184877345

6 years agoUpdate TFLite iOS Camera Example app to use TFLite CocoaPod.
Yu-Cheng Ling [Wed, 7 Feb 2018 20:05:01 +0000 (12:05 -0800)]
Update TFLite iOS Camera Example app to use TFLite CocoaPod.

PiperOrigin-RevId: 184874871

6 years agoUpdate to type-dependent while loop, and tests for it.
A. Unique TensorFlower [Wed, 7 Feb 2018 20:01:40 +0000 (12:01 -0800)]
Update to type-dependent while loop, and tests for it.

PiperOrigin-RevId: 184874151

6 years agoPrototype for object-based save/restore
Allen Lavoie [Wed, 7 Feb 2018 19:48:15 +0000 (11:48 -0800)]
Prototype for object-based save/restore

Includes deferred restoration (mostly useful for eager execution).

Slot variables are created with their checkpointed values as soon as the variable they're slotting for is restored, so there's no need to override slot creation (optimizers already check for existing slot variables before creating a new one).

Changes the behavior of unnamed Checkpointable dependencies so that only other unnamed dependencies can interfere (named dependencies do not get a number). This should be a bit more robust, and will support property assignment syntax sugar in a future CL. It does mean that removing a name from a dependency will break the checkpoint (just like changing its name would).

One minor fix for slot creation eager compatibility.

PiperOrigin-RevId: 184871747

6 years agoUpdate BUILD
Yifei Feng [Wed, 7 Feb 2018 19:51:55 +0000 (11:51 -0800)]
Update BUILD

6 years agomake calling NNAPI work again
A. Unique TensorFlower [Wed, 7 Feb 2018 19:17:01 +0000 (11:17 -0800)]
make calling NNAPI work again
(this a copy of #16256 which apparently got lost in the one of the merges)

PiperOrigin-RevId: 184866202

6 years agoUpdated copyright from 2017 to 2018
Ankur Taly [Wed, 7 Feb 2018 19:15:47 +0000 (11:15 -0800)]
Updated copyright from 2017 to 2018

6 years agoAdd unsortedsegment(prod/min/max/sqrt_n/mean). (#15858)
Phil [Wed, 7 Feb 2018 18:59:59 +0000 (19:59 +0100)]
Add unsortedsegment(prod/min/max/sqrt_n/mean). (#15858)

* Add unsortedsegment(prod/min/max/sqrt_n/mean).

This commit adds CPU/GPU implementations for prod/min/max
ops and python implementations for mean/sqrt_n. Also, it adapts and unifies the
corresponding tests of all unsorted reductions.
Note: The new gradient of unsorted_segment_max fixes the crash occuring when
negative indices on CPU are used.

* update golden API

* Fix compilation of atomicAdd for cuda_arch < 600. \n This commit moves the std::complex specialization of atomicAdd below the double specialization of atomicAdd for cuda_arch 600.

* Enable bfloat16, change inline to EIGEN_STRONG_INLINE.

* fix includes of cuda_device_functions; fix typo

6 years agoImprove model_pruner:
A. Unique TensorFlower [Wed, 7 Feb 2018 18:30:39 +0000 (10:30 -0800)]
Improve model_pruner:
  * Actually remove nodes marked for removal if fetches are known.
  * Remove trivial nodes even in the presence of control inputs, except
    for Identity nodes when
      a) they are anchored on an Identity following a Switch node and
         removal would require anchoring a control identity on the Switch, or
      b) they have control inputs and feed a Merge node.
  * Remove nodes only when in_degree * out_degree <= in_degree + out_degree.

Move input deduping utility function to utils.{h,cc}.

PiperOrigin-RevId: 184858685

6 years ago[XLA:CPU] Fix/suppress issues caught by the C++ linter
Sanjoy Das [Wed, 7 Feb 2018 18:18:53 +0000 (10:18 -0800)]
[XLA:CPU] Fix/suppress issues caught by the C++ linter

PiperOrigin-RevId: 184856538

6 years agoMake TypeError more explicit on _assertAllCloseRecursive
A. Unique TensorFlower [Wed, 7 Feb 2018 17:08:51 +0000 (09:08 -0800)]
Make TypeError more explicit on _assertAllCloseRecursive

PiperOrigin-RevId: 184846656

6 years agoAdding support for standalone Tanh operator.
A. Unique TensorFlower [Wed, 7 Feb 2018 17:01:44 +0000 (09:01 -0800)]
Adding support for standalone Tanh operator.

PiperOrigin-RevId: 184845130

6 years agoRefactor score definition in GMM operations. This is simplified to be the per-sample...
A. Unique TensorFlower [Wed, 7 Feb 2018 16:48:05 +0000 (08:48 -0800)]
Refactor score definition in GMM operations. This is simplified to be the per-sample likelihood of the data.

PiperOrigin-RevId: 184843634

6 years agoRemove warnings in tf.losses.softmax_cross_entropy
Yong Tang [Wed, 7 Feb 2018 16:24:34 +0000 (16:24 +0000)]
Remove warnings in tf.losses.softmax_cross_entropy

This fix tries to address the issue raised in 16534 where
tf.losses.softmax_cross_entropy causes warnings due
to the calling of tf.nn.softmax_cross_entropy_with_logits.

This fix switches to tf.nn.softmax_cross_entropy_with_logits_v2
to remove the warning.

This fix fixes 16534.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
6 years agoUtilities for type checking and multiple dispatch.
A. Unique TensorFlower [Wed, 7 Feb 2018 15:16:17 +0000 (07:16 -0800)]
Utilities for type checking and multiple dispatch.

PiperOrigin-RevId: 184834434

6 years agoSupport for quantized LstmCell, with initial reference runtime code.
A. Unique TensorFlower [Wed, 7 Feb 2018 14:30:32 +0000 (06:30 -0800)]
Support for quantized LstmCell, with initial reference runtime code.
The current 'optimized' code is just a copy of the reference code,
a true optimized implementation will follow separately.

PiperOrigin-RevId: 184830223

6 years ago[XLA:CPU] Assert more thoroughly on preconditions in VectorSupportlibrary
Sanjoy Das [Wed, 7 Feb 2018 07:55:28 +0000 (23:55 -0800)]
[XLA:CPU] Assert more thoroughly on preconditions in VectorSupportlibrary

No behavior change intended.

PiperOrigin-RevId: 184797003

6 years ago[XLA] Use HloVerifiedTestBase in AlgebraicSimplifierTest
Sanjoy Das [Wed, 7 Feb 2018 07:54:26 +0000 (23:54 -0800)]
[XLA] Use HloVerifiedTestBase in AlgebraicSimplifierTest

And fix the fallout.  Thanks to asbirlea@ for noticing this!

PiperOrigin-RevId: 184796949

6 years agoTypo in variable name: BETA --> self.BETA (#16666)
cclauss [Wed, 7 Feb 2018 06:54:21 +0000 (07:54 +0100)]
Typo in variable name: BETA --> self.BETA (#16666)

__BETA__ is defined on line 118 as a class member so it can only be accessed via __self__ or via the __ElasticAverageOptimizer__.

flake8 testing of https://github.com/tensorflow/tensorflow

$ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__
```
./tensorflow/contrib/opt/python/training/elastic_average_optimizer.py:153:27: F821 undefined name 'BETA'
      self._moving_rate = BETA / communication_period / num_worker
                          ^
```

6 years agoFix incorrect links in CONTRIBUTING.md (#16814)
Yong Tang [Wed, 7 Feb 2018 06:53:33 +0000 (22:53 -0800)]
Fix incorrect links in CONTRIBUTING.md (#16814)

This fix fixes two incorrect links in CONTRIBUTING.md
about license examples. The reason for broken links
is because tensorboard is in another repo.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
6 years ago[XLA:CPU] Add an LLVM IR implementation of Exp
Sanjoy Das [Wed, 7 Feb 2018 06:48:48 +0000 (22:48 -0800)]
[XLA:CPU] Add an LLVM IR implementation of Exp

This lets us avoid the usual set of issues that crop up when XLA generated code
has to call into C++.

PiperOrigin-RevId: 184793093

6 years agoAdd pylint check for W0611 unused-import in ci_sanity.sh and fix existing pylint...
Yifei Feng [Wed, 7 Feb 2018 06:05:26 +0000 (22:05 -0800)]
Add pylint check for W0611 unused-import in ci_sanity.sh and fix existing pylint errors.

PiperOrigin-RevId: 184790548

6 years agoLSTM for TFlite/Toco
Zhixian Yan [Wed, 7 Feb 2018 05:32:48 +0000 (21:32 -0800)]
LSTM for TFlite/Toco

PiperOrigin-RevId: 184788311

6 years agoClear feed error on session start.
Russell Power [Wed, 7 Feb 2018 05:19:50 +0000 (21:19 -0800)]
Clear feed error on session start.

An existing hook can be re-used on a different session: rather than terminating
the session we should clear the error state.

PiperOrigin-RevId: 184787368

6 years agoTPUEstimator: Revert the global_step change and require the user to explicitly
Jonathan Hseu [Wed, 7 Feb 2018 04:40:00 +0000 (20:40 -0800)]
TPUEstimator: Revert the global_step change and require the user to explicitly
pass it.

PiperOrigin-RevId: 184784330

6 years ago[XLA:CPU] Use VectorSupportLibrary for LLVM IR implementation of tanh
Sanjoy Das [Wed, 7 Feb 2018 02:28:00 +0000 (18:28 -0800)]
[XLA:CPU] Use VectorSupportLibrary for LLVM IR implementation of tanh

No behavioral change intended; this is only refactoring.

VectorSupportLibrary was added after the LLVM IR implementation of tanh so the
tanh implementation was not using VectorSupportLibrary.

The main impetus for this change is that I'm about to add LLVM IR
implementations of Exp and Log, and those are going to use VectorSupportLibrary.
I did not want to have an inconsistency between the tanh and exp, log.

PiperOrigin-RevId: 184774860

6 years agoWe used to bypass fake-quant nodes in resolve_reorder_axes, as a hack as we
A. Unique TensorFlower [Wed, 7 Feb 2018 02:26:02 +0000 (18:26 -0800)]
We used to bypass fake-quant nodes in resolve_reorder_axes, as a hack as we
needed to preserve fake-quant nodes on constant weights as the only way to
encode min-max information when exporting to GraphDef.

Not anymore. Now we unconditionally enable the resolve_constant_fake_quant
transformation, and we don't do this bypass anymore; instead, when exporting
to GraphDef, we re-add FakeQuant nodes just before exporting, around
constant arrays that have minmax.

PiperOrigin-RevId: 184774680

6 years agoMerge commit for internal changes
Ankur Taly [Wed, 7 Feb 2018 02:13:46 +0000 (18:13 -0800)]
Merge commit for internal changes

6 years ago[tf.data] Fix a memory leak when an iterator is reinitialized many times in a session.
Derek Murray [Wed, 7 Feb 2018 01:37:02 +0000 (17:37 -0800)]
[tf.data] Fix a memory leak when an iterator is reinitialized many times in a session.

Previously, we would instantiate a new function handle for each
function in a dataset each time an iterator on that dataset was
initialized. These would only be deleted at session closure, which
could lead to an apparent leak of memory over the lifetime of session.

PiperOrigin-RevId: 184768730

6 years agoFix memory tracking in the case where temp memory is used as output memory.
Yuefeng Zhou [Wed, 7 Feb 2018 01:32:50 +0000 (17:32 -0800)]
Fix memory tracking in the case where temp memory is used as output memory.
Track all persistent memory allocation in allocate_persistent call except for variables and queues where persistent memory is tracked in variables ops and queue ops. Deallocation of persistent memory is ignored.

PiperOrigin-RevId: 184768231

6 years agoSync the opensource and non-opensource build
Andrew Selle [Wed, 7 Feb 2018 01:10:31 +0000 (17:10 -0800)]
Sync the opensource and non-opensource build

PiperOrigin-RevId: 184765632