From: Frank Chen Date: Wed, 10 Jan 2018 19:36:52 +0000 (-0800) Subject: Merge changes from github. X-Git-Tag: v1.6.0-rc0~285^2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c4ef927b5eaf144dbf1e0419c0d1d3fd968177bd;p=platform%2Fupstream%2Ftensorflow.git Merge changes from github. PiperOrigin-RevId: 181494416 --- diff --git a/RELEASE.md b/RELEASE.md index e04bd3fc50..b24e83f053 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,67 @@ +# Release 1.5.0 + +## Breaking Changes +* Prebuilt binaries are now built against CUDA 9 and cuDNN 7. +* Our Linux binaries are built using ubuntu 16 containers, potentially + introducing glibc incompatibility issues with ubuntu 14. +* Starting from 1.6 release, our prebuilt binaries will use AVX instructions. + This may break TF on older CPUs. + +## Major Features And Improvements +* [Eager execution](https://github.com/tensorflow/tensorflow/tree/r1.5/tensorflow/contrib/eager) + preview version is now available. +* [TensorFlow Lite](https://github.com/tensorflow/tensorflow/tree/r1.5/tensorflow/contrib/lite) + dev preview is now available. +* CUDA 9 and cuDNN 7 support. + +## Bug Fixes and Other Changes +* `auto_correlation` added to `tf.contrib.distributions`. +* Add `DenseFlipout` probabilistic layer. +* Restandardize `DenseVariational` as simpler template for other probabilistic layers. +* Make `tf.contrib.distributions` QuadratureCompound classes support batch. +* `Stream::BlockHostUntilDone` now returns Status rather than bool. +* Customize request timeouts for the GCS filesystem. + +## Thanks to our Contributors + +This release contains contributions from many people at Google, as well as: + +4d55397500, Abdullah Alrasheed, abenmao, Adam Salvail, Aditya Dhulipala, Ag Ramesh, +Akimasa Kimura, Alan Du, Alan Yee, Alexander, Amit Kushwaha, Amy, Andrei Costinescu, +Andrei Nigmatulin, Andrew Erlichson, Andrew Myers, Andrew Stepanov, Androbin, AngryPowman, +Anish Shah, Anton Daitche, Artsiom Chapialiou, asdf2014, Aseem Raj Baranwal, Ash Hall, +Bart Kiers, Batchu Venkat Vishal, ben, Ben Barsdell, Bill Piel, Carl Thomé, Catalin Voss, +Changming Sun, Chengzhi Chen, Chi Zeng, Chris Antaki, Chris Donahue, Chris Oelmueller, +Chris Tava, Clayne Robison, Codrut, Courtial Florian, Dalmo Cirne, Dan J, Darren Garvey, +David Kristoffersson, David Norman, David RöThlisberger, DavidNorman, Dhruv, DimanNe, +Dorokhov, Duncan Mac-Vicar P, EdwardDixon, EMCP, error.d, FAIJUL, Fan Xia, +Francois Xavier, Fred Reiss, Freedom" Koan-Sin Tan, Fritz Obermeyer, Gao, Xiang, +Guenther Schmuelling, Guo Yejun (郭叶军), Hans Gaiser, HectorSVC, Hyungsuk Yoon, +James Pruegsanusak, Jay Young, Jean Wanka, Jeff Carpenter, Jeremy Rutman, Jeroen BéDorf, +Jett Jones, Jimmy Jia, jinghuangintel, jinze1994, JKurland, Joel Hestness, joetoth, +John B Nelson, John Impallomeni, John Lawson, Jonas, Jonathan Dekhtiar, joshkyh, Jun Luan, +Jun Mei, Kai Sasaki, Karl Lessard, karl@kubx.ca, Kb Sriram, Kenichi Ueno, Kevin Slagle, +Kongsea, Lakshay Garg, lhlmgr, Lin Min, liu.guangcong, Loki Der Quaeler, Louie Helm, +lucasmoura, Luke Iwanski, Lyndon White, Mahmoud Abuzaina, Marcel Puyat, Mark Aaron Shirley, +Michele Colombo, MtDersvan, Namrata-Ibm, Nathan Luehr, Naurril, Nayana Thorat, Nicolas Lopez, +Niranjan Hasabnis, Nolan Liu, Nouce, Oliver Hennigh, osdamv, Patrik Erdes, +Patryk Chrabaszcz, Pavel Christof, Penghao Cen, postBG, Qingqing Cao, Qingying Chen, qjivy, +Raphael, Rasmi, raymondxyang, Renze Yu, resec, Roffel, Ruben Vereecken, Ryohei Kuroki, +sandipmgiri, Santiago Castro, Scott Kirkland, Sean Vig, Sebastian Raschka, Sebastian Weiss, +Sergey Kolesnikov, Sergii Khomenko, Shahid, Shivam Kotwalia, Stuart Berg, Sumit Gouthaman, +superzerg, Sven Mayer, tetris, Ti Zhou, Tiago Freitas Pereira, Tian Jin, Tomoaki Oiki, +Vaibhav Sood, vfdev, Vivek Rane, Vladimir Moskva, wangqr, Weber Xie, Will Frey, +Yan Facai (颜发才), yanivbl6, Yaroslav Bulatov, Yixing Lao, Yong Tang, youkaichao, +Yuan (Terry) Tang, Yue Zhang, Yuxin Wu, Ziming Dong, ZxYuan, 黄璞 + +We are also grateful to all who filed issues or helped resolve them, asked and +answered questions, and were part of inspiring discussions. + +# Release 1.4.1 + +## Bug Fixes and Other Changes +* `LinearClassifier` fix for the Google Cloud Machine Learning Engine. + # Release 1.4.0 ## Major Features And Improvements diff --git a/configure.py b/configure.py index 7537e308b5..cf16ef4837 100644 --- a/configure.py +++ b/configure.py @@ -302,6 +302,12 @@ def get_var(environ_cp, Returns: boolean value of the variable. + + Raises: + UserInputError: if an environment variable is set, but it cannot be + interpreted as a boolean indicator, assume that the user has made a + scripting error, and will continue to provide invalid input. + Raise the error to avoid infinitely looping. """ if not question: question = 'Do you wish to build TensorFlow with %s support?' % query_item @@ -319,6 +325,23 @@ def get_var(environ_cp, question += ' [y/N]: ' var = environ_cp.get(var_name) + if var is not None: + var_content = var.strip().lower() + true_strings = ('1', 't', 'true', 'y', 'yes') + false_strings = ('0', 'f', 'false', 'n', 'no') + if var_content in true_strings: + var = True + elif var_content in false_strings: + var = False + else: + raise UserInputError( + 'Environment variable %s must be set as a boolean indicator.\n' + 'The following are accepted as TRUE : %s.\n' + 'The following are accepted as FALSE: %s.\n' + 'Current value is %s.' % ( + var_name, ', '.join(true_strings), ', '.join(false_strings), + var)) + while var is None: user_input_origin = get_input(question) user_input = user_input_origin.strip().lower() @@ -605,8 +628,9 @@ def prompt_loop_or_load_from_env( Raises: UserInputError: if a query has been attempted n_ask_attempts times without - success, assume that the user has made a scripting error, and will continue - to provide invalid input. Raise the error to avoid infinitely looping. + success, assume that the user has made a scripting error, and will + continue to provide invalid input. Raise the error to avoid infinitely + looping. """ default = environ_cp.get(var_name) or var_default full_query = '%s [Default is %s]: ' % ( @@ -1101,11 +1125,13 @@ def set_computecpp_toolkit_path(environ_cp): def set_trisycl_include_dir(environ_cp): """Set TRISYCL_INCLUDE_DIR.""" + ask_trisycl_include_dir = ('Please specify the location of the triSYCL ' 'include directory. (Use --config=sycl_trisycl ' 'when building with Bazel) ' '[Default is %s]: ' ) % (_DEFAULT_TRISYCL_INCLUDE_DIR) + while True: trisycl_include_dir = get_from_env_or_user_or_default( environ_cp, 'TRISYCL_INCLUDE_DIR', ask_trisycl_include_dir, diff --git a/tensorflow/contrib/data/python/kernel_tests/BUILD b/tensorflow/contrib/data/python/kernel_tests/BUILD index 22942c5cbf..96d2491575 100644 --- a/tensorflow/contrib/data/python/kernel_tests/BUILD +++ b/tensorflow/contrib/data/python/kernel_tests/BUILD @@ -117,7 +117,6 @@ py_test( py_library( name = "dataset_serialization_test", - testonly = 1, srcs = [ "dataset_serialization_test_base.py", ], diff --git a/tensorflow/contrib/eager/python/examples/linear_regression/linear_regression.py b/tensorflow/contrib/eager/python/examples/linear_regression/linear_regression.py index 7bc5007c56..f4b7d67f94 100644 --- a/tensorflow/contrib/eager/python/examples/linear_regression/linear_regression.py +++ b/tensorflow/contrib/eager/python/examples/linear_regression/linear_regression.py @@ -41,7 +41,7 @@ class LinearModel(tfe.Network): For those familiar with TensorFlow graphs, notice the absence of `tf.Session`. The `forward()` method here immediately executes and returns output values. The `loss()` method immediately compares the - output of `forward()` with the target adn returns the MSE loss value. + output of `forward()` with the target and returns the MSE loss value. The `fit()` performs gradient-descent training on the model's weights and bias. """ diff --git a/tensorflow/contrib/eager/python/examples/mnist/mnist.py b/tensorflow/contrib/eager/python/examples/mnist/mnist.py index bb121c7704..82b3d3919c 100644 --- a/tensorflow/contrib/eager/python/examples/mnist/mnist.py +++ b/tensorflow/contrib/eager/python/examples/mnist/mnist.py @@ -40,7 +40,7 @@ class MNISTModel(tfe.Network): """MNIST Network. Network structure is equivalent to: - https://github.com/tensorflow/tensorflow/blob/r1.4/tensorflow/examples/tutorials/mnist/mnist_deep.py + https://github.com/tensorflow/tensorflow/blob/r1.5/tensorflow/examples/tutorials/mnist/mnist_deep.py and https://github.com/tensorflow/models/blob/master/tutorials/image/mnist/convolutional.py diff --git a/tensorflow/contrib/libsvm/kernels/decode_libsvm_op.cc b/tensorflow/contrib/libsvm/kernels/decode_libsvm_op.cc index 616240fda8..720c74e3de 100644 --- a/tensorflow/contrib/libsvm/kernels/decode_libsvm_op.cc +++ b/tensorflow/contrib/libsvm/kernels/decode_libsvm_op.cc @@ -46,34 +46,47 @@ class DecodeLibsvmOp : public OpKernel { std::vector out_values; std::vector> out_indices; for (int i = 0; i < input_flat.size(); ++i) { - std::vector entries = - str_util::Split(input_flat(i), " ", str_util::SkipEmpty()); - OP_REQUIRES(ctx, !entries.empty(), - errors::InvalidArgument("No entries found for input[", i, + StringPiece line(input_flat(i)); + str_util::RemoveWhitespaceContext(&line); + + StringPiece piece; + OP_REQUIRES(ctx, str_util::ConsumeNonWhitespace(&line, &piece), + errors::InvalidArgument("No label found for input[", i, "]: \"", input_flat(i), "\"")); + Tlabel label_value; - OP_REQUIRES( - ctx, strings::SafeStringToNumeric(entries[0], &label_value), - errors::InvalidArgument("Label format incorrect: ", entries[0])); + OP_REQUIRES(ctx, + strings::SafeStringToNumeric(piece, &label_value), + errors::InvalidArgument("Label format incorrect: ", piece)); + label(i) = label_value; - for (int j = 1; j < entries.size(); j++) { - std::vector pair = str_util::Split(entries[j], ":"); - OP_REQUIRES( - ctx, (pair.size() == 2), - errors::InvalidArgument("Invalid feature \"", entries[j], "\"")); + + str_util::RemoveLeadingWhitespace(&line); + while (str_util::ConsumeNonWhitespace(&line, &piece)) { + size_t p = piece.find(':'); + OP_REQUIRES(ctx, (p != StringPiece::npos), + errors::InvalidArgument("Invalid feature \"", piece, "\"")); + int64 feature_index; OP_REQUIRES( - ctx, strings::safe_strto64(pair[0].c_str(), &feature_index), - errors::InvalidArgument("Feature format incorrect: ", entries[j])); + ctx, strings::safe_strto64(piece.substr(0, p), &feature_index), + errors::InvalidArgument("Feature format incorrect: ", piece)); OP_REQUIRES(ctx, (feature_index >= 0), errors::InvalidArgument( "Feature index should be >= 0, got ", feature_index)); + T feature_value; OP_REQUIRES( - ctx, strings::SafeStringToNumeric(pair[1], &feature_value), - errors::InvalidArgument("Feature format incorrect: ", entries[j])); + + ctx, + strings::SafeStringToNumeric(piece.substr(p + 1), + &feature_value), + errors::InvalidArgument("Feature format incorrect: ", piece)); + out_values.emplace_back(feature_value); out_indices.emplace_back(std::pair(i, feature_index)); + + str_util::RemoveLeadingWhitespace(&line); } } diff --git a/tensorflow/contrib/makefile/README.md b/tensorflow/contrib/makefile/README.md index 9345303ff1..0613de2cab 100644 --- a/tensorflow/contrib/makefile/README.md +++ b/tensorflow/contrib/makefile/README.md @@ -262,6 +262,14 @@ to register ops and kernels. #### Optimization +The `build_all_ios.sh` script can take optional command-line arguments to +selectively register only for the operators used in your graph. + +```bash +tensorflow/contrib/makefile/build_all_ios.sh -a arm64 -g $HOME/graphs/inception/tensorflow_inception_graph.pb +``` +Please note this is an aggresive optimization of the operators and the resulting library may not work with other graphs but will reduce the size of the final library. + The `compile_ios_tensorflow.sh` script can take optional command-line arguments. The first argument will be passed as a C++ optimization flag and defaults to debug mode. If you are concerned about performance or are working on a release diff --git a/tensorflow/contrib/makefile/build_all_ios.sh b/tensorflow/contrib/makefile/build_all_ios.sh index 988e12b482..a18df256f9 100755 --- a/tensorflow/contrib/makefile/build_all_ios.sh +++ b/tensorflow/contrib/makefile/build_all_ios.sh @@ -26,13 +26,16 @@ fi usage() { echo "Usage: $(basename "$0") [-a:T]" echo "-a [build_arch] build only for specified arch x86_64 [default=all]" + echo "-g [graph] optimize and selectively register ops only for this graph" echo "-T only build tensorflow (dont download other deps etc)" exit 1 } -while getopts "a:T" opt_name; do +DEFAULT_ARCH="i386 x86_64 armv7 armv7s arm64" +while getopts "a:g:T" opt_name; do case "$opt_name" in a) BUILD_ARCH="${OPTARG}";; + g) OPTIMIZE_FOR_GRAPH="${OPTARG}";; T) ONLY_MAKE_TENSORFLOW="true";; *) usage;; esac @@ -42,7 +45,8 @@ shift $((OPTIND - 1)) # Make sure we're in the correct directory, at the root of the source tree. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -cd ${SCRIPT_DIR}/../../../ +TOP_SRCDIR="${SCRIPT_DIR}/../../../" +cd ${TOP_SRCDIR} source "${SCRIPT_DIR}/build_helper.subr" JOB_COUNT="${JOB_COUNT:-$(get_job_count)}" @@ -56,6 +60,32 @@ if [[ -n MACOSX_DEPLOYMENT_TARGET ]]; then export MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion) fi +PRNT_SLCTV_BIN="${TOP_SRCDIR}bazel-bin/tensorflow/python/tools/print_selective_registration_header" + +if [[ ! -z "${OPTIMIZE_FOR_GRAPH}" ]]; then + echo "Request to optimize for graph: ${OPTIMIZE_FOR_GRAPH}" + #Request to trim the OPs by selectively registering + if [ ! -f ${PRNT_SLCTV_BIN} ]; then + #Build bazel build tensorflow/python/tools:print_selective_registration_header + echo "${PRNT_SLCTV_BIN} not found. Trying to build it" + cd ${TOP_SRCDIR} + bazel build --copt="-DUSE_GEMM_FOR_CONV" tensorflow/python/tools:print_selective_registration_header + if [ ! -f ${PRNT_SLCTV_BIN} ]; then + echo "Building print_selective_registration_header failed" + echo "You may want to build TensorFlow with: " + echo "./configure" + echo "bazel build --copt="-DUSE_GEMM_FOR_CONV" tensorflow/python/tools:print_selective_registration_header" + echo "and then run this script again" + exit 1 + fi + else + echo "${PRNT_SLCTV_BIN} found. Using it" + ${PRNT_SLCTV_BIN} --graphs=${OPTIMIZE_FOR_GRAPH} > ${TOP_SRCDIR}/tensorflow/core/framework/ops_to_register.h + + fi + +fi + if [[ "${ONLY_MAKE_TENSORFLOW}" != "true" ]]; then # Remove any old files first. make -f tensorflow/contrib/makefile/Makefile clean @@ -64,8 +94,13 @@ if [[ "${ONLY_MAKE_TENSORFLOW}" != "true" ]]; then # Pull down the required versions of the frameworks we need. tensorflow/contrib/makefile/download_dependencies.sh - # Compile protobuf for the target iOS device architectures. - tensorflow/contrib/makefile/compile_ios_protobuf.sh + if [[ -z "${BUILD_ARCH}" ]]; then + # Compile protobuf for the target iOS device architectures. + tensorflow/contrib/makefile/compile_ios_protobuf.sh -a ${DEFAULT_ARCH} + else + # Compile protobuf for the target iOS device architectures. + tensorflow/contrib/makefile/compile_ios_protobuf.sh -a ${BUILD_ARCH} + fi fi # Compile nsync for the target iOS device architectures. @@ -80,13 +115,24 @@ else fi export HOST_NSYNC_LIB TARGET_NSYNC_LIB -if [[ -z "${BUILD_ARCH}" ]]; then - # build the ios tensorflow libraries. - tensorflow/contrib/makefile/compile_ios_tensorflow.sh -f "-O3" -h $HOST_NSYNC_LIB -n $TARGET_NSYNC_LIB -else +TF_CC_FLAGS="-O3" +TF_SCRIPT_FLAGS="-h ${HOST_NSYNC_LIB} -n ${TARGET_NSYNC_LIB}" + +if [[ ! -z "${OPTIMIZE_FOR_GRAPH}" ]]; then + # arch specified so build just that + TF_CC_FLAGS="${TF_CC_FLAGS} -DANDROID_TYPES=__ANDROID_TYPES_FULL__ -DSELECTIVE_REGISTRATION -DSUPPORT_SELECTIVE_REGISTRATION" + # The Makefile checks the env var to decide which ANDROID_TYPES to build + export ANDROID_TYPES="-D__ANDROID_TYPES_FULL__" +fi + +if [[ ! -z "${BUILD_ARCH}" ]]; then # arch specified so build just that - tensorflow/contrib/makefile/compile_ios_tensorflow.sh -f "-O3" -a "${BUILD_ARCH}" -h $HOST_NSYNC_LIB -n $TARGET_NSYNC_LIB + TF_SCRIPT_FLAGS="${TF_SCRIPT_FLAGS} -a ${BUILD_ARCH}" fi +# build the ios tensorflow libraries. +echo "Building TensorFlow with flags: ${TF_SCRIPT_FLAGS} -f ${TF_CC_FLAGS}" +tensorflow/contrib/makefile/compile_ios_tensorflow.sh ${TF_SCRIPT_FLAGS} -f "${TF_CC_FLAGS}" + # Creates a static universal library in # tensorflow/contrib/makefile/gen/lib/libtensorflow-core.a diff --git a/tensorflow/core/api_def/base_api/api_def_GatherNd.pbtxt b/tensorflow/core/api_def/base_api/api_def_GatherNd.pbtxt index c7f8b6c21b..6cd76ff340 100644 --- a/tensorflow/core/api_def/base_api/api_def_GatherNd.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_GatherNd.pbtxt @@ -43,6 +43,10 @@ of `params`. The output tensor has shape indices.shape[:-1] + params.shape[indices.shape[-1]:] +Note that on CPU, if an out of bound index is found, an error is returned. +On GPU, if an out of bound index is found, a 0 is stored in the +corresponding output value. + Some examples below. Simple indexing into a matrix: diff --git a/tensorflow/core/api_def/base_api/api_def_GatherV2.pbtxt b/tensorflow/core/api_def/base_api/api_def_GatherV2.pbtxt index c020176a3b..162ef2b033 100644 --- a/tensorflow/core/api_def/base_api/api_def_GatherV2.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_GatherV2.pbtxt @@ -50,5 +50,9 @@ params.shape[axis + 1:]` where:
+ +Note that on CPU, if an out of bound index is found, an error is returned. +On GPU, if an out of bound index is found, a 0 is stored in the +corresponding output value. END } diff --git a/tensorflow/core/api_def/base_api/api_def_ScatterNd.pbtxt b/tensorflow/core/api_def/base_api/api_def_ScatterNd.pbtxt index 23732546ed..4cb8c064fc 100644 --- a/tensorflow/core/api_def/base_api/api_def_ScatterNd.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_ScatterNd.pbtxt @@ -98,5 +98,8 @@ The resulting tensor would look like this: [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]] + +Note that on CPU, if an out of bound index is found, an error is returned. +On GPU, if an out of bound index is found, the index is ignored. END } diff --git a/tensorflow/core/framework/numeric_types.h b/tensorflow/core/framework/numeric_types.h index 650aa4203e..8514d7c474 100644 --- a/tensorflow/core/framework/numeric_types.h +++ b/tensorflow/core/framework/numeric_types.h @@ -25,7 +25,6 @@ limitations under the License. #include "third_party/eigen3/unsupported/Eigen/CXX11/FixedPoint" // clang-format on -#include "tensorflow/core/platform/cpu_info.h" #include "tensorflow/core/platform/types.h" namespace tensorflow { diff --git a/tensorflow/core/graph/mkl_layout_pass.cc b/tensorflow/core/graph/mkl_layout_pass.cc index 0ffdc42852..89b23f22fd 100644 --- a/tensorflow/core/graph/mkl_layout_pass.cc +++ b/tensorflow/core/graph/mkl_layout_pass.cc @@ -2507,36 +2507,42 @@ class MklLayoutRewritePass : public GraphOptimizationPass { rinfo_.push_back({csinfo_.max_pool_grad, mkl_op_registry::GetMklOpName(csinfo_.max_pool_grad), CopyAttrsPooling, AlwaysRewrite}); + /* rinfo_.push_back({csinfo_.maximum, mkl_op_registry::GetMklOpName(csinfo_.maximum), CopyAttrsDataType, AlwaysRewrite}); rinfo_.push_back({csinfo_.mul, mkl_op_registry::GetMklOpName(csinfo_.mul), CopyAttrsDataType, AlwaysRewrite}); + */ rinfo_.push_back({csinfo_.relu, mkl_op_registry::GetMklOpName(csinfo_.relu), CopyAttrsDataType, AlwaysRewrite}); rinfo_.push_back({csinfo_.relu_grad, mkl_op_registry::GetMklOpName(csinfo_.relu_grad), CopyAttrsDataType, AlwaysRewrite}); + /* rinfo_.push_back({csinfo_.tanh, mkl_op_registry::GetMklOpName(csinfo_.tanh), CopyAttrsDataType, AlwaysRewrite}); rinfo_.push_back({csinfo_.tanh_grad, mkl_op_registry::GetMklOpName(csinfo_.tanh_grad), CopyAttrsDataType, AlwaysRewrite}); + */ rinfo_.push_back({csinfo_.reshape, mkl_op_registry::GetMklOpName(csinfo_.reshape), CopyAttrsReshape, AlwaysRewrite}); rinfo_.push_back({csinfo_.softmax, mkl_op_registry::GetMklOpName(csinfo_.softmax), CopyAttrsDataType, AlwaysRewrite}); + /* rinfo_.push_back({csinfo_.squared_difference, mkl_op_registry::GetMklOpName(csinfo_.squared_difference), CopyAttrsDataType, AlwaysRewrite}); rinfo_.push_back({csinfo_.sub, mkl_op_registry::GetMklOpName(csinfo_.sub), CopyAttrsDataType, AlwaysRewrite}); + */ // Add info about which ops to add workspace edge to and the slots. wsinfo_.push_back({csinfo_.lrn, csinfo_.lrn_grad, 0, 2, 1, 3}); diff --git a/tensorflow/core/kernels/conv_ops_gpu_3.cu.cc b/tensorflow/core/kernels/conv_ops_gpu_3.cu.cc index 172deea1da..2a464943c2 100644 --- a/tensorflow/core/kernels/conv_ops_gpu_3.cu.cc +++ b/tensorflow/core/kernels/conv_ops_gpu_3.cu.cc @@ -541,6 +541,7 @@ constexpr bool TileSizePossibilityFrontierCheck(int TileLongSide, int TileShortSide, int size_of_t, Op op) { // clang-format off + return (size_of_t == 16 && ((TileLongSide == 32 && op(TileShortSide, 4)) || (TileLongSide == 64 && op(TileShortSide, 4)) || (TileLongSide == 128 && op(TileShortSide, 4)) || @@ -568,6 +569,7 @@ constexpr bool TileSizePossibilityFrontierCheck(int TileLongSide, (TileLongSide == 256 && op(TileShortSide, 8)) || (TileLongSide == 512 && op(TileShortSide, 4)) || (TileLongSide == 1024 && op(TileShortSide, 2)))); + // clang-format on } diff --git a/tensorflow/core/kernels/mkl_concat_op.cc b/tensorflow/core/kernels/mkl_concat_op.cc index d0175dfd71..82771792d7 100644 --- a/tensorflow/core/kernels/mkl_concat_op.cc +++ b/tensorflow/core/kernels/mkl_concat_op.cc @@ -650,10 +650,6 @@ class MklConcatOp : public OpKernel { // format and avoid calling eigen version. if (!are_all_tf_inputs && !are_all_mkl_inputs) invoke_eigen = true; - // Temporary fallback to Eigen until MKLDNN Concat performance - // is improved. To be removed. - invoke_eigen = true; - // Call Eigen library if (invoke_eigen) { TensorShapeList tf_input_shapes; @@ -694,7 +690,7 @@ class MklConcatOp : public OpKernel { // It does not matter what data format we use here (NHWC or NCHW). // We just need to ensure that output of Concat uses same data format // as input. - memory::desc(src_dims, MklDnnType(), memory::format::nhwc); + memory::desc(src_dims, MklDnnType(), memory::format::nchw); srcs[k].SetUsrMem(src_md, &input_tensors[k]); auto src_mpd = srcs[k].GetUsrMemPrimDesc(); @@ -720,7 +716,7 @@ class MklConcatOp : public OpKernel { } else { // Again, format does not matter here. We just need to make it same as // input format. - dst_md = memory::desc(dst_dims, MklDnnType(), memory::format::nhwc); + dst_md = memory::desc(dst_dims, MklDnnType(), memory::format::nchw); } std::vector inputs; diff --git a/tensorflow/core/kernels/record_input_op.cc b/tensorflow/core/kernels/record_input_op.cc index 0c053490a0..841f9dc4b8 100644 --- a/tensorflow/core/kernels/record_input_op.cc +++ b/tensorflow/core/kernels/record_input_op.cc @@ -38,6 +38,7 @@ class RecordInputOp : public OpKernel { GETATTR(int64, batch_size); GETATTR(string, compression_type); #undef GETATTR + OP_REQUIRES_OK(ctx, ctx->GetAttr("compression_type", &compression_type)); RecordYielder::Options yopts; diff --git a/tensorflow/core/platform/default/build_config.bzl b/tensorflow/core/platform/default/build_config.bzl index 942bca6eec..6d83f8b7fd 100644 --- a/tensorflow/core/platform/default/build_config.bzl +++ b/tensorflow/core/platform/default/build_config.bzl @@ -67,16 +67,14 @@ def pyx_library( pxd_srcs.append(src) # Invoke cython to produce the shared object libraries. - cpp_outs = [src.split(".")[0] + ".cpp" for src in pyx_srcs] - native.genrule( - name = name + "_cython_translation", - srcs = pyx_srcs, - outs = cpp_outs, - cmd = ("PYTHONHASHSEED=0 $(location @cython//:cython_binary) --cplus $(SRCS)" - # Rename outputs to expected location. - + """ && python -c 'import shutil, sys; n = len(sys.argv); [shutil.copyfile(src.split(".")[0] + ".cpp", dst) for src, dst in zip(sys.argv[1:], sys.argv[1+n//2:])]' $(SRCS) $(OUTS)"""), - tools = ["@cython//:cython_binary"] + pxd_srcs, - ) + for filename in pyx_srcs: + native.genrule( + name = filename + "_cython_translation", + srcs = [filename], + outs = [filename.split(".")[0] + ".cpp"], + cmd = "PYTHONHASHSEED=0 $(location @cython//:cython_binary) --cplus $(SRCS) --output-file $(OUTS)", + tools = ["@cython//:cython_binary"] + pxd_srcs, + ) shared_objects = [] for src in pyx_srcs: diff --git a/tensorflow/core/platform/default/stacktrace.h b/tensorflow/core/platform/default/stacktrace.h index 436716d482..c8e297fa8d 100644 --- a/tensorflow/core/platform/default/stacktrace.h +++ b/tensorflow/core/platform/default/stacktrace.h @@ -66,6 +66,8 @@ inline std::string CurrentStackTrace() { ss << "*** End stack trace ***" << std::endl; return ss.str(); +#else + return std::string(); #endif // defined(TF_GENERATE_BACKTRACE) } diff --git a/tensorflow/core/profiler/g3doc/advise.md b/tensorflow/core/profiler/g3doc/advise.md index d0de8317f6..379c3f1ef6 100644 --- a/tensorflow/core/profiler/g3doc/advise.md +++ b/tensorflow/core/profiler/g3doc/advise.md @@ -1,6 +1,6 @@ ## Auto Detect and Advise -tfprof analyzes profiles and generates advises for common issues. +tfprof analyzes profiles and generates advice for common issues. ### Run Advise. diff --git a/tensorflow/core/public/version.h b/tensorflow/core/public/version.h index c037a9b122..3baab75e27 100644 --- a/tensorflow/core/public/version.h +++ b/tensorflow/core/public/version.h @@ -19,12 +19,12 @@ limitations under the License. // TensorFlow uses semantic versioning, see http://semver.org/. #define TF_MAJOR_VERSION 1 -#define TF_MINOR_VERSION 4 +#define TF_MINOR_VERSION 5 #define TF_PATCH_VERSION 0 // TF_VERSION_SUFFIX is non-empty for pre-releases (e.g. "-alpha", "-alpha.1", // "-beta", "-rc", "-rc.1") -#define TF_VERSION_SUFFIX "" +#define TF_VERSION_SUFFIX "-rc0" #define TF_STR_HELPER(x) #x #define TF_STR(x) TF_STR_HELPER(x) diff --git a/tensorflow/docs_src/api_guides/cc/guide.md b/tensorflow/docs_src/api_guides/cc/guide.md index 81fb1e1fda..4e51ada58a 100644 --- a/tensorflow/docs_src/api_guides/cc/guide.md +++ b/tensorflow/docs_src/api_guides/cc/guide.md @@ -1,6 +1,6 @@ # C++ API -Note: By default [tensorflow.org](http://tensorflow.org) shows docs for the +Note: By default [tensorflow.org](https://www.tensorflow.org) shows docs for the most recent stable version. The instructions in this doc require building from source. You will probably want to build from the `master` version of tensorflow. You should, as a result, be sure you are following the diff --git a/tensorflow/docs_src/extend/adding_an_op.md b/tensorflow/docs_src/extend/adding_an_op.md index c52279b212..15075e1df8 100644 --- a/tensorflow/docs_src/extend/adding_an_op.md +++ b/tensorflow/docs_src/extend/adding_an_op.md @@ -1,6 +1,6 @@ # Adding a New Op -Note: By default [tensorflow.org](http://tensorflow.org) shows docs for the +Note: By default [www.tensorflow.org](https://www.tensorflow.org) shows docs for the most recent stable version. The instructions in this doc require building from source. You will probably want to build from the `master` version of tensorflow. You should, as a result, be sure you are following the diff --git a/tensorflow/docs_src/install/index.md b/tensorflow/docs_src/install/index.md index c4fc882ddd..3c8488643f 100644 --- a/tensorflow/docs_src/install/index.md +++ b/tensorflow/docs_src/install/index.md @@ -4,7 +4,7 @@ We've built and tested TensorFlow on the following 64-bit laptop/desktop operating systems: * MacOS X 10.11 (El Capitan) or later. - * Ubuntu 14.04 or later + * Ubuntu 16.04 or later * Windows 7 or later. Although you might be able to install TensorFlow on other laptop or desktop diff --git a/tensorflow/docs_src/install/install_c.md b/tensorflow/docs_src/install/install_c.md index df622c6ac5..d79cd1415d 100644 --- a/tensorflow/docs_src/install/install_c.md +++ b/tensorflow/docs_src/install/install_c.md @@ -38,7 +38,7 @@ enable TensorFlow for C: OS="linux" # Change to "darwin" for macOS TARGET_DIRECTORY="/usr/local" curl -L \ - "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-${OS}-x86_64-1.4.0.tar.gz" | + "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-${OS}-x86_64-1.5.0-rc0.tar.gz" | sudo tar -C $TARGET_DIRECTORY -xz The `tar` command extracts the TensorFlow C library into the `lib` diff --git a/tensorflow/docs_src/install/install_go.md b/tensorflow/docs_src/install/install_go.md index 8b3da49a0d..49f5350405 100644 --- a/tensorflow/docs_src/install/install_go.md +++ b/tensorflow/docs_src/install/install_go.md @@ -38,7 +38,7 @@ steps to install this library and enable TensorFlow for Go: TF_TYPE="cpu" # Change to "gpu" for GPU support TARGET_DIRECTORY='/usr/local' curl -L \ - "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-$(go env GOOS)-x86_64-1.4.0.tar.gz" | + "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-$(go env GOOS)-x86_64-1.5.0-rc0.tar.gz" | sudo tar -C $TARGET_DIRECTORY -xz The `tar` command extracts the TensorFlow C library into the `lib` diff --git a/tensorflow/docs_src/install/install_java.md b/tensorflow/docs_src/install/install_java.md index d189fa4f95..47b1251427 100644 --- a/tensorflow/docs_src/install/install_java.md +++ b/tensorflow/docs_src/install/install_java.md @@ -17,7 +17,7 @@ instructions might also work on other variants, we have only tested (and we only support) these instructions on machines meeting the following requirements: - * Ubuntu 14.04 or higher; 64-bit, x86 + * Ubuntu 16.04 or higher; 64-bit, x86 * macOS X 10.11 (El Capitan) or higher * Windows 7 or higher; 64-bit, x86 @@ -36,7 +36,7 @@ following to the project's `pom.xml` to use the TensorFlow Java APIs: org.tensorflow tensorflow - 1.4.0 + 1.5.0-rc0 ``` @@ -65,7 +65,7 @@ As an example, these steps will create a Maven project that uses TensorFlow: org.tensorflow tensorflow - 1.4.0 + 1.5.0-rc0 @@ -147,7 +147,7 @@ refer to the simpler instructions above instead. Take the following steps to install TensorFlow for Java on Linux or macOS: 1. Download - [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.4.0.jar), + [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.5.0-rc0.jar), which is the TensorFlow Java Archive (JAR). 2. Decide whether you will run TensorFlow for Java on CPU(s) only or with @@ -166,7 +166,7 @@ Take the following steps to install TensorFlow for Java on Linux or macOS: OS=$(uname -s | tr '[:upper:]' '[:lower:]') mkdir -p ./jni curl -L \ - "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-${TF_TYPE}-${OS}-x86_64-1.4.0.tar.gz" | + "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-${TF_TYPE}-${OS}-x86_64-1.5.0-rc0.tar.gz" | tar -xz -C ./jni ### Install on Windows @@ -174,10 +174,10 @@ Take the following steps to install TensorFlow for Java on Linux or macOS: Take the following steps to install TensorFlow for Java on Windows: 1. Download - [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.4.0.jar), + [libtensorflow.jar](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-1.5.0-rc0.jar), which is the TensorFlow Java Archive (JAR). 2. Download the following Java Native Interface (JNI) file appropriate for - [TensorFlow for Java on Windows](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-cpu-windows-x86_64-1.4.0.zip). + [TensorFlow for Java on Windows](https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-cpu-windows-x86_64-1.5.0-rc0.zip). 3. Extract this .zip file. @@ -225,7 +225,7 @@ must be part of your `classpath`. For example, you can include the downloaded `.jar` in your `classpath` by using the `-cp` compilation flag as follows: -
javac -cp libtensorflow-1.4.0.jar HelloTF.java
+
javac -cp libtensorflow-1.5.0-rc0.jar HelloTF.java
### Running @@ -239,11 +239,11 @@ two files are available to the JVM: For example, the following command line executes the `HelloTF` program on Linux and macOS X: -
java -cp libtensorflow-1.4.0.jar:. -Djava.library.path=./jni HelloTF
+
java -cp libtensorflow-1.5.0-rc0.jar:. -Djava.library.path=./jni HelloTF
And the following command line executes the `HelloTF` program on Windows: -
java -cp libtensorflow-1.4.0.jar;. -Djava.library.path=jni HelloTF
+
java -cp libtensorflow-1.5.0-rc0.jar;. -Djava.library.path=jni HelloTF
If the program prints Hello from version, you've successfully installed TensorFlow for Java and are ready to use the API. If the program diff --git a/tensorflow/docs_src/install/install_linux.md b/tensorflow/docs_src/install/install_linux.md index ff40c905eb..bb1d9a9f57 100644 --- a/tensorflow/docs_src/install/install_linux.md +++ b/tensorflow/docs_src/install/install_linux.md @@ -6,7 +6,7 @@ tested (and we only support) these instructions on machines meeting the following requirements: * 64-bit desktops or laptops - * Ubuntu 14.04 or higher + * Ubuntu 16.04 or higher ## Determine which TensorFlow to install @@ -188,7 +188,7 @@ Take the following steps to install TensorFlow with Virtualenv: Virtualenv environment:
(tensorflow)$ pip3 install --upgrade \
-     https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp34-cp34m-linux_x86_64.whl
+ https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.5.0rc0-cp34-cp34m-linux_x86_64.whl If you encounter installation problems, see [Common Installation Problems](#common_installation_problems). @@ -293,7 +293,7 @@ take the following steps:
      $ sudo pip3 install --upgrade \
-     https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp34-cp34m-linux_x86_64.whl
+     https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.5.0rc0-cp34-cp34m-linux_x86_64.whl
      
If this step fails, see @@ -480,7 +480,7 @@ Take the following steps to install TensorFlow in an Anaconda environment:
      (tensorflow)$ pip install --ignore-installed --upgrade \
-     https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp34-cp34m-linux_x86_64.whl
+ https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.5.0rc0-cp34-cp34m-linux_x86_64.whl @@ -648,14 +648,14 @@ This section documents the relevant values for Linux installations. CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp27-none-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.5.0rc0-cp27-none-linux_x86_64.whl
 
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.4.0-cp27-none-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.5.0rc0-cp27-none-linux_x86_64.whl
 
Note that GPU support requires the NVIDIA hardware and software described in @@ -667,14 +667,14 @@ Note that GPU support requires the NVIDIA hardware and software described in CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp34-cp34m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.5.0rc0-cp34-cp34m-linux_x86_64.whl
 
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.4.0-cp34-cp34m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.5.0rc0-cp34-cp34m-linux_x86_64.whl
 
Note that GPU support requires the NVIDIA hardware and software described in @@ -686,14 +686,14 @@ Note that GPU support requires the NVIDIA hardware and software described in CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp35-cp35m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.5.0rc0-cp35-cp35m-linux_x86_64.whl
 
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.4.0-cp35-cp35m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.5.0rc0-cp35-cp35m-linux_x86_64.whl
 
@@ -705,14 +705,14 @@ Note that GPU support requires the NVIDIA hardware and software described in CPU only:
-https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp36-cp36m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.5.0rc0-cp36-cp36m-linux_x86_64.whl
 
GPU support:
-https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.4.0-cp36-cp36m-linux_x86_64.whl
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.5.0rc0-cp36-cp36m-linux_x86_64.whl
 
diff --git a/tensorflow/docs_src/install/install_mac.md b/tensorflow/docs_src/install/install_mac.md index 12bd07c175..cf1c5157f8 100644 --- a/tensorflow/docs_src/install/install_mac.md +++ b/tensorflow/docs_src/install/install_mac.md @@ -115,7 +115,7 @@ Take the following steps to install TensorFlow with Virtualenv: TensorFlow in the active Virtualenv is as follows:
 $ pip3 install --upgrade \
-     https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.4.0-py2-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.5.0rc0-py2-none-any.whl If you encounter installation problems, see [Common Installation Problems](#common-installation-problems). @@ -238,7 +238,7 @@ take the following steps: issue the following command:
 $ sudo pip3 install --upgrade \
-     https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.4.0-py2-none-any.whl 
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.5.0rc0-py2-none-any.whl If the preceding command fails, see [installation problems](#common-installation-problems). @@ -347,7 +347,7 @@ Take the following steps to install TensorFlow in an Anaconda environment: TensorFlow for Python 2.7:
 (targetDirectory)$ pip install --ignore-installed --upgrade \
-     https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.4.0-py2-none-any.whl
+ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.5.0rc0-py2-none-any.whl @@ -520,7 +520,7 @@ This section documents the relevant values for Mac OS installations.
-https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.4.0-py2-none-any.whl
+https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.5.0rc0-py2-none-any.whl
 
@@ -528,5 +528,5 @@ https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.4.0-py2-none-any.
-https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.4.0-py3-none-any.whl
+https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.5.0rc0-py3-none-any.whl
 
diff --git a/tensorflow/docs_src/install/install_sources.md b/tensorflow/docs_src/install/install_sources.md index e453bd6ca1..90e93f56c5 100644 --- a/tensorflow/docs_src/install/install_sources.md +++ b/tensorflow/docs_src/install/install_sources.md @@ -25,8 +25,10 @@ like to try to build TensorFlow on Windows anyway, use either of the following: * [Bazel on Windows](https://bazel.build/versions/master/docs/windows.html) -* [TensorFlow CMake build](https://github.com/tensorflow/tensorflow/tree/r0.12/tensorflow/contrib/cmake) +* [TensorFlow CMake build](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/cmake) +Note: Starting from 1.6 release, our prebuilt binaries will use AVX +instructions. Older CPUs may not be able to execute these binaries. ## Determine which TensorFlow to install @@ -359,10 +361,10 @@ Invoke `pip install` to install that pip package. The filename of the `.whl` file depends on your platform. For example, the following command will install the pip package -for TensorFlow 1.4.0 on Linux: +for TensorFlow 1.5.0rc0 on Linux:
-$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.4.0-py2-none-any.whl
+$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.5.0rc0-py2-none-any.whl
 
## Validate your installation diff --git a/tensorflow/docs_src/tutorials/image_retraining.md b/tensorflow/docs_src/tutorials/image_retraining.md index 52e6980e00..df15bc0a9c 100644 --- a/tensorflow/docs_src/tutorials/image_retraining.md +++ b/tensorflow/docs_src/tutorials/image_retraining.md @@ -390,7 +390,7 @@ image size that your model expects, as follows: python tensorflow/examples/label_image/label_image.py \ --graph=/tmp/output_graph.pb --labels=/tmp/output_labels.txt \ --input_layer=input \ ---output_layer=final_result:0 \ +--output_layer=final_result \ --input_height=224 --input_width=224 \ --input_mean=128 --input_std=128 \ --image=$HOME/flower_photos/daisy/21652746_cc379e0eea_m.jpg diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD index c62ff10828..97467c59f1 100644 --- a/tensorflow/python/BUILD +++ b/tensorflow/python/BUILD @@ -1238,6 +1238,7 @@ py_test( srcs = ["framework/dtypes_test.py"], main = "framework/dtypes_test.py", srcs_version = "PY2AND3", + tags = ["no_windows"], deps = [ ":framework_for_generated_wrappers", ":framework_test_lib", @@ -3506,6 +3507,7 @@ py_test( size = "small", srcs = ["lib/core/bfloat16_test.py"], srcs_version = "PY2AND3", + tags = ["no_windows"], deps = [ ":client_testlib", ":lib", diff --git a/tensorflow/python/debug/wrappers/dumping_wrapper.py b/tensorflow/python/debug/wrappers/dumping_wrapper.py index 962318e54a..3fac2e5971 100644 --- a/tensorflow/python/debug/wrappers/dumping_wrapper.py +++ b/tensorflow/python/debug/wrappers/dumping_wrapper.py @@ -73,6 +73,7 @@ class DumpingDebugWrapperSession(framework.NonInteractiveDebugWrapperSession): self, sess, watch_fn=watch_fn, thread_name_filter=thread_name_filter, pass_through_operrors=pass_through_operrors) + session_root = os.path.expanduser(session_root) if gfile.Exists(session_root): if not gfile.IsDirectory(session_root): raise ValueError( diff --git a/tensorflow/python/debug/wrappers/local_cli_wrapper.py b/tensorflow/python/debug/wrappers/local_cli_wrapper.py index c46a4e7d1a..1465cb7295 100644 --- a/tensorflow/python/debug/wrappers/local_cli_wrapper.py +++ b/tensorflow/python/debug/wrappers/local_cli_wrapper.py @@ -82,6 +82,7 @@ class LocalCLIDebugWrapperSession(framework.BaseDebugWrapperSession): if not dump_root: self._dump_root = tempfile.mktemp(prefix=_DUMP_ROOT_PREFIX) else: + dump_root = os.path.expanduser(dump_root) if os.path.isfile(dump_root): raise ValueError("dump_root path points to a file: %s" % dump_root) elif os.path.isdir(dump_root) and os.listdir(dump_root): diff --git a/tensorflow/python/eager/backprop.py b/tensorflow/python/eager/backprop.py index 56a49301a2..ec31bc9bb7 100644 --- a/tensorflow/python/eager/backprop.py +++ b/tensorflow/python/eager/backprop.py @@ -550,7 +550,7 @@ def _ensure_unique_tensor_objects(parameter_positions, args): def val_and_grad_function(f, params=None): - """Returns a function that computes f and is derivative w.r.t. params. + """Returns a function that computes f and its derivative w.r.t. params. Example: ```python diff --git a/tensorflow/python/estimator/training_test.py b/tensorflow/python/estimator/training_test.py index 2d3f5d6cef..4f7da84808 100644 --- a/tensorflow/python/estimator/training_test.py +++ b/tensorflow/python/estimator/training_test.py @@ -326,7 +326,7 @@ class TrainAndEvaluateTest(test.TestCase): mock_executor.assert_called_with(estimator=mock_est, train_spec=mock_train_spec, eval_spec=mock_eval_spec) - mock_executor_instance.run.assert_called() + self.assertTrue(mock_executor_instance.run.called) def test_error_out_if_evaluator_task_id_is_non_zero(self): tf_config = { diff --git a/tensorflow/python/ops/array_ops.py b/tensorflow/python/ops/array_ops.py index 88d1ce537c..7ada03c3ae 100644 --- a/tensorflow/python/ops/array_ops.py +++ b/tensorflow/python/ops/array_ops.py @@ -1090,6 +1090,27 @@ def concat(values, axis, name="concat"): tf.shape(tf.concat([t3, t4], 0)) # [4, 3] tf.shape(tf.concat([t3, t4], 1)) # [2, 6] ``` + As in Python, the `axis` could also be negative numbers. Negative `axis` + are interpreted as counting from the end of the rank, i.e., + `axis + rank(values)`-th dimension. + + For example: + + ```python + t1 = [[[1, 2], [2, 3]], [[4, 4], [5, 3]]] + t2 = [[[7, 4], [8, 4]], [[2, 10], [15, 11]]] + tf.concat([t1, t2], -1) + ``` + + would produce: + + ```python + [[[ 1, 2, 7, 4], + [ 2, 3, 8, 4]], + + [[ 4, 4, 2, 10], + [ 5, 3, 15, 11]]] + ``` Note: If you are concatenating along a new axis consider using stack. E.g. @@ -1107,7 +1128,10 @@ def concat(values, axis, name="concat"): Args: values: A list of `Tensor` objects or a single `Tensor`. axis: 0-D `int32` `Tensor`. Dimension along which to concatenate. Must be - in the range `[-rank(values), rank(values))`. + in the range `[-rank(values), rank(values))`. As in Python, indexing + for axis is 0-based. Positive axis in the rage of + `[0, rank(values))` refers to `axis`-th dimension. And negative axis + refers to `axis + rank(values)`-th dimension. name: A name for the operation (optional). Returns: diff --git a/tensorflow/python/ops/gradient_checker.py b/tensorflow/python/ops/gradient_checker.py index 1ff1968055..65cc6ff7dc 100644 --- a/tensorflow/python/ops/gradient_checker.py +++ b/tensorflow/python/ops/gradient_checker.py @@ -181,7 +181,7 @@ def _compute_numeric_jacobian(x, x_shape, x_data, y, y_shape, delta, def _compute_dx_and_dy(x, y, y_shape): - """Returns a node to compute gradient of x wrt y.""" + """Returns a node to compute gradient of y wrt x.""" # We make up a dy so that we can compute the gradients. We don't really use # the value of dy -- we will always feed it. We need to add an identity node # so that we can always feed it properly. Otherwise, for the Add operation, @@ -189,7 +189,7 @@ def _compute_dx_and_dy(x, y, y_shape): with x.graph.as_default(): dy_orig = constant_op.constant(1.0, shape=y_shape, dtype=y.dtype) dy = array_ops.identity(dy_orig) - # We compute the gradients for x wrt. y + # We compute the gradients for y wrt. x grads = gradients.gradients(y, x, dy) assert len(grads) == 1 return grads[0], dy_orig diff --git a/tensorflow/python/ops/image_ops_impl.py b/tensorflow/python/ops/image_ops_impl.py index 7f494db1a1..9bebffd8d6 100644 --- a/tensorflow/python/ops/image_ops_impl.py +++ b/tensorflow/python/ops/image_ops_impl.py @@ -999,8 +999,8 @@ def adjust_gamma(image, gamma=1, gain=1): Args: image : A Tensor. - gamma : A scalar. Non negative real number. - gain : A scalar. The constant multiplier. + gamma : A scalar or tensor. Non negative real number. + gain : A scalar or tensor. The constant multiplier. Returns: A Tensor. Gamma corrected output image. @@ -1019,17 +1019,20 @@ def adjust_gamma(image, gamma=1, gain=1): """ with ops.op_scope([image, gamma, gain], None, 'adjust_gamma'): - # Convert pixel value to DT_FLOAT for computing adjusted image + # Convert pixel value to DT_FLOAT for computing adjusted image. img = ops.convert_to_tensor(image, name='img', dtype=dtypes.float32) - # Keep image dtype for computing the scale of corresponding dtype + # Keep image dtype for computing the scale of corresponding dtype. image = ops.convert_to_tensor(image, name='image') - if gamma < 0: - raise ValueError('Gamma should be a non-negative real number') - # scale = max(dtype) - min(dtype) + assert_op = _assert(gamma >= 0, ValueError, + 'Gamma should be a non-negative real number.') + if assert_op: + gamma = control_flow_ops.with_dependencies(assert_op, gamma) + + # scale = max(dtype) - min(dtype). scale = constant_op.constant(image.dtype.limits[1] - image.dtype.limits[0], dtype=dtypes.float32) - # According to the definition of gamma correction + # According to the definition of gamma correction. adjusted_img = (img / scale) ** gamma * scale * gain return adjusted_img diff --git a/tensorflow/python/ops/image_ops_test.py b/tensorflow/python/ops/image_ops_test.py index 3d73b77291..3a49d41c9e 100644 --- a/tensorflow/python/ops/image_ops_test.py +++ b/tensorflow/python/ops/image_ops_test.py @@ -189,6 +189,44 @@ class AdjustGamma(test_util.TensorFlowTestCase): self.assertAllClose(y_tf, y_np, 1e-6) + def test_adjust_gamma_less_zero(self): + """White image should be returned for gamma equal to zero""" + with self.test_session(): + x_data = np.random.uniform(0, 255, (8, 8)) + x_np = np.array(x_data, dtype=np.float32) + + x = constant_op.constant(x_np, shape=x_np.shape) + + err_msg = 'Gamma should be a non-negative real number.' + + try: + image_ops.adjust_gamma(x, gamma=-1) + except Exception as e: + if err_msg not in str(e): + raise + else: + raise AssertionError("Exception not raised: %s" % err_msg) + + def test_adjust_gamma_less_zero_tensor(self): + """White image should be returned for gamma equal to zero""" + with self.test_session(): + x_data = np.random.uniform(0, 255, (8, 8)) + x_np = np.array(x_data, dtype=np.float32) + + x = constant_op.constant(x_np, shape=x_np.shape) + y = constant_op.constant(-1.0, dtype=dtypes.float32) + + image = image_ops.adjust_gamma(x, gamma=y) + + err_msg = 'Gamma should be a non-negative real number.' + try: + image.eval() + except Exception as e: + if err_msg not in str(e): + raise + else: + raise AssertionError("Exception not raised: %s" % err_msg) + def test_adjust_gamma_zero(self): """White image should be returned for gamma equal to zero""" with self.test_session(): diff --git a/tensorflow/python/ops/resource_variable_ops.py b/tensorflow/python/ops/resource_variable_ops.py index 60a32b1dbc..879c206313 100644 --- a/tensorflow/python/ops/resource_variable_ops.py +++ b/tensorflow/python/ops/resource_variable_ops.py @@ -886,11 +886,6 @@ def _GatherGrad(op, grad): # Build appropriately shaped IndexedSlices handle = op.inputs[0] indices = op.inputs[1] - if context.in_graph_mode(): - # Walk graph back until the original handle is found. - # TODO(apassos): implement this for EAGER mode. - while handle.op.type != "VarHandleOp": - handle = handle.op.inputs[0] params_shape = gen_resource_variable_ops.variable_shape(handle) size = array_ops.expand_dims(array_ops.size(indices), 0) values_shape = array_ops.concat([size, params_shape[1:]], 0) diff --git a/tensorflow/tools/ci_build/install/install_python3.5_pip_packages.sh b/tensorflow/tools/ci_build/install/install_python3.5_pip_packages.sh index dd2a2f3a5d..aefc49f604 100755 --- a/tensorflow/tools/ci_build/install/install_python3.5_pip_packages.sh +++ b/tensorflow/tools/ci_build/install/install_python3.5_pip_packages.sh @@ -60,7 +60,7 @@ pip3.5 install --no-binary=:all: --upgrade numpy==1.12.0 pip3.5 install scipy==0.18.1 -pip3.5 install scikit-learn==0.18.1 +pip3.5 install scikit-learn==0.19.1 # pandas required by `inflow` pip3 install pandas==0.19.2 diff --git a/tensorflow/tools/ci_build/install/install_python3.6_pip_packages.sh b/tensorflow/tools/ci_build/install/install_python3.6_pip_packages.sh index 6e846ef878..bfaa044c82 100755 --- a/tensorflow/tools/ci_build/install/install_python3.6_pip_packages.sh +++ b/tensorflow/tools/ci_build/install/install_python3.6_pip_packages.sh @@ -47,8 +47,6 @@ cd Python-3.6.1 ./configure make altinstall -pip3.6 -V -which pip3.6 ln -s /usr/local/bin/pip3.6 /usr/local/bin/pip3 pip3 install --upgrade virtualenv @@ -73,7 +71,7 @@ pip3 install --no-binary=:all: --upgrade numpy==1.12.0 pip3 install scipy==0.18.1 -pip3 install scikit-learn==0.18.1 +pip3 install scikit-learn==0.19.1 # pandas required by `inflow` pip3 install pandas==0.19.2 diff --git a/tensorflow/tools/docker/Dockerfile.devel b/tensorflow/tools/docker/Dockerfile.devel index cd22f1832f..5dc4a053fd 100644 --- a/tensorflow/tools/docker/Dockerfile.devel +++ b/tensorflow/tools/docker/Dockerfile.devel @@ -70,7 +70,7 @@ RUN mkdir /bazel && \ # Download and build TensorFlow. WORKDIR /tensorflow -RUN git clone --branch=r1.4 --depth=1 https://github.com/tensorflow/tensorflow.git . +RUN git clone --branch=r1.5 --depth=1 https://github.com/tensorflow/tensorflow.git . # TODO(craigcitro): Don't install the pip package, since it makes it # more difficult to experiment with local changes. Instead, just add diff --git a/tensorflow/tools/docker/Dockerfile.devel-cpu-mkl b/tensorflow/tools/docker/Dockerfile.devel-cpu-mkl index 8180e5e7fb..96b260ad3a 100644 --- a/tensorflow/tools/docker/Dockerfile.devel-cpu-mkl +++ b/tensorflow/tools/docker/Dockerfile.devel-cpu-mkl @@ -3,7 +3,7 @@ FROM tensorflow/tensorflow:latest-devel LABEL maintainer="Clayne Robison" # These arguments are parameterized. Use --build-args to override. -ARG TF_BRANCH=r1.4 +ARG TF_BRANCH=r1.5 ARG WHL_DIR=/whl RUN apt-get update && apt-get install -y --no-install-recommends \ @@ -54,7 +54,7 @@ RUN ./configure RUN LD_LIBRARY_PATH=${LD_LIBRARY_PATH} \ bazel build --config=mkl \ --config="opt" \ - --copt="-march=native" \ + --copt="-march=broadwell" \ --copt="-O3" \ //tensorflow/tools/pip_package:build_pip_package && \ mkdir ${WHL_DIR} && \ @@ -81,5 +81,3 @@ RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/issue && cat /etc/motd' \ ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n\ \n "\ > /etc/motd - -CMD ["/bin/bash"] diff --git a/tensorflow/tools/docker/Dockerfile.devel-gpu b/tensorflow/tools/docker/Dockerfile.devel-gpu index d0c540ae56..07ffd3839a 100644 --- a/tensorflow/tools/docker/Dockerfile.devel-gpu +++ b/tensorflow/tools/docker/Dockerfile.devel-gpu @@ -79,7 +79,7 @@ RUN mkdir /bazel && \ # Download and build TensorFlow. WORKDIR /tensorflow -RUN git clone --branch=r1.4 --depth=1 https://github.com/tensorflow/tensorflow.git . +RUN git clone --branch=r1.5 --depth=1 https://github.com/tensorflow/tensorflow.git . # Configure the build for our CUDA configuration. ENV CI_BUILD_PYTHON python diff --git a/tensorflow/tools/git/gen_git_source.py b/tensorflow/tools/git/gen_git_source.py index f2845c877f..3630dbd740 100755 --- a/tensorflow/tools/git/gen_git_source.py +++ b/tensorflow/tools/git/gen_git_source.py @@ -16,7 +16,10 @@ """Help include git hash in tensorflow bazel build. This creates symlinks from the internal git repository directory so -that the build system can see changes in the version state. +that the build system can see changes in the version state. We also +remember what branch git was on so when the branch changes we can +detect that the ref file is no longer correct (so we can suggest users +run ./configure again). NOTE: this script is only used in opensource. @@ -218,14 +221,13 @@ def generate(arglist): if not data["git"]: git_version = b"unknown" else: - old_branch = data["branch"] + old_branch = data["branch"] new_branch = parse_branch_ref(head_symlink) if new_branch != old_branch: - print("Warning, run ./configure again, to get __git_version__ to record " - "correct version") - git_version = get_git_version(data["path"])+'-inconsistent-git-version' - else: - git_version = get_git_version(data["path"]) + raise RuntimeError( + "Run ./configure again, branch was '%s' but is now '%s'" % + (old_branch, new_branch)) + git_version = get_git_version(data["path"]) write_version_info(dest_file, git_version) diff --git a/tensorflow/tools/pip_package/BUILD b/tensorflow/tools/pip_package/BUILD index 28cb953297..7afba97761 100644 --- a/tensorflow/tools/pip_package/BUILD +++ b/tensorflow/tools/pip_package/BUILD @@ -154,6 +154,7 @@ sh_binary( "//tensorflow:tensorflow_py", "//tensorflow/contrib/boosted_trees:boosted_trees_pip", "//tensorflow/contrib/cluster_resolver:cluster_resolver_pip", + "//tensorflow/contrib/data/python/kernel_tests:dataset_serialization_test", "//tensorflow/contrib/data/python/ops:prefetching_py", "//tensorflow/contrib/eager/python/examples:examples_pip", "//tensorflow/contrib/eager/python:checkpointable", diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py index e03faee61e..2e31d6ebab 100644 --- a/tensorflow/tools/pip_package/setup.py +++ b/tensorflow/tools/pip_package/setup.py @@ -29,7 +29,7 @@ from setuptools.dist import Distribution # This version string is semver compatible, but incompatible with pip. # For pip, we will remove all '-' characters from this string, and use the # result for pip. -_VERSION = '1.4.0' +_VERSION = '1.5.0-rc0' REQUIRED_PACKAGES = [ 'absl-py >= 0.1.6', diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index 0ac32a8059..ef8caf22a0 100644 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl @@ -97,11 +97,11 @@ def tf_workspace(path_prefix="", tf_repo_name=""): tf_http_archive( name = "eigen_archive", urls = [ - "https://mirror.bazel.build/bitbucket.org/eigen/eigen/get/c2947c341c68.tar.gz", - "https://bitbucket.org/eigen/eigen/get/c2947c341c68.tar.gz", + "https://mirror.bazel.build/bitbucket.org/eigen/eigen/get/034b6c3e1017.tar.gz", + "https://bitbucket.org/eigen/eigen/get/034b6c3e1017.tar.gz", ], - sha256 = "f21f8ab8a8dbcb91cd0deeade19a043f47708d0da7a4000164cdf203b4a71e34", - strip_prefix = "eigen-eigen-c2947c341c68", + sha256 = "0a8ac1e83ef9c26c0e362bd7968650b710ce54e2d883f0df84e5e45a3abe842a", + strip_prefix = "eigen-eigen-034b6c3e1017", build_file = str(Label("//third_party:eigen.BUILD")), ) diff --git a/third_party/git/git_configure.bzl b/third_party/git/git_configure.bzl index bd197bfd24..47e2125854 100644 --- a/third_party/git/git_configure.bzl +++ b/third_party/git/git_configure.bzl @@ -1,4 +1,31 @@ -"""Repository rule for Git autoconfiguration.""" +"""Repository rule for Git autoconfiguration. + +`git_configure` depends on the following environment variables: + + * `PYTHON_BIN_PATH`: location of python binary. +""" + +_PYTHON_BIN_PATH = "PYTHON_BIN_PATH" + +def _fail(msg): + """Output failure message when auto configuration fails.""" + red = "\033[0;31m" + no_color = "\033[0m" + fail("%sGit Configuration Error:%s %s\n" % (red, no_color, msg)) + +def _get_python_bin(repository_ctx): + """Gets the python bin path.""" + python_bin = repository_ctx.os.environ.get(_PYTHON_BIN_PATH) + if python_bin != None: + return python_bin + python_bin_path = repository_ctx.which("python") + if python_bin_path != None: + return str(python_bin_path) + _fail("Cannot find python in PATH, please make sure " + + "python is installed and add its directory in PATH, or --define " + + "%s='/something/else'.\nPATH=%s" % ( + _PYTHON_BIN_PATH, repository_ctx.os.environ.get("PATH", ""))) + def _git_conf_impl(repository_ctx): repository_ctx.template( @@ -11,10 +38,18 @@ def _git_conf_impl(repository_ctx): Label("@org_tensorflow//tensorflow/tools/git:gen_git_source.py")) generated_files_path = repository_ctx.path("gen") - repository_ctx.execute([ + result = repository_ctx.execute([ + _get_python_bin(repository_ctx), python_script_path, "--configure", tensorflow_root_path, "--gen_root_path", generated_files_path], quiet=False) + if not result.return_code == 0: + _fail(result.stderr) + + git_configure = repository_rule( implementation = _git_conf_impl, + environ = [ + _PYTHON_BIN_PATH, + ], ) diff --git a/third_party/repo.bzl b/third_party/repo.bzl index c29fef9629..11e9c842d2 100644 --- a/third_party/repo.bzl +++ b/third_party/repo.bzl @@ -22,6 +22,14 @@ _SINGLE_URL_WHITELIST = depset([ def _is_windows(ctx): return ctx.os.name.lower().find("windows") != -1 +def _wrap_bash_cmd(ctx, cmd): + if _is_windows(ctx): + bazel_sh = _get_env_var(ctx, "BAZEL_SH") + if not bazel_sh: + fail("BAZEL_SH environment variable is not set") + cmd = [bazel_sh, "-c", " ".join(cmd)] + return cmd + def _get_env_var(ctx, name): if name in ctx.os.environ: return ctx.os.environ[name] @@ -46,12 +54,8 @@ def _apply_patch(ctx, patch_file): # Don't check patch on Windows, because patch is only available under bash. if not _is_windows(ctx) and not ctx.which("patch"): fail("patch command is not found, please install it") - cmd = ["patch", "-p1", "-d", ctx.path("."), "-i", ctx.path(patch_file)] - if _is_windows(ctx): - bazel_sh = _get_env_var(ctx, "BAZEL_SH") - if not bazel_sh: - fail("BAZEL_SH environment variable is not set") - cmd = [bazel_sh, "-c", " ".join(cmd)] + cmd = _wrap_bash_cmd( + ctx, ["patch", "-p1", "-d", ctx.path("."), "-i", ctx.path(patch_file)]) _execute_and_check_ret_code(ctx, cmd) def _apply_delete(ctx, paths): @@ -60,8 +64,8 @@ def _apply_delete(ctx, paths): fail("refusing to rm -rf path starting with '/': " + path) if ".." in path: fail("refusing to rm -rf path containing '..': " + path) - _execute_and_check_ret_code( - ctx, ["rm", "-rf"] + [ctx.path(path) for path in paths]) + cmd = _wrap_bash_cmd(ctx, ["rm", "-rf"] + [ctx.path(path) for path in paths]) + _execute_and_check_ret_code(ctx, cmd) def _tf_http_archive(ctx): if ("mirror.bazel.build" not in ctx.attr.urls[0] or