aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CODEOWNERS4
-rwxr-xr-xconfigure20
-rw-r--r--tensorflow/cc/framework/gradients.cc2
-rw-r--r--tensorflow/compiler/tf2xla/xla_op_registry.h7
-rw-r--r--tensorflow/compiler/xla/util.cc1
-rw-r--r--tensorflow/contrib/cluster_resolver/python/training/cluster_resolver.py4
-rw-r--r--tensorflow/contrib/cmake/README.md2
-rw-r--r--tensorflow/contrib/framework/python/ops/variables.py6
-rw-r--r--tensorflow/contrib/learn/python/learn/dataframe/transforms/boolean_mask.py2
-rw-r--r--tensorflow/contrib/learn/python/learn/estimators/head.py7
-rwxr-xr-xtensorflow/contrib/makefile/build_all_ios.sh9
-rwxr-xr-xtensorflow/contrib/makefile/compile_ios_protobuf.sh5
-rwxr-xr-xtensorflow/contrib/makefile/compile_ios_tensorflow.sh6
-rw-r--r--tensorflow/contrib/signal/python/ops/reconstruction_ops.py2
-rw-r--r--tensorflow/contrib/slim/python/slim/evaluation.py2
-rw-r--r--tensorflow/contrib/tfprof/README.md6
-rw-r--r--tensorflow/contrib/timeseries/python/timeseries/model.py2
-rw-r--r--tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py2
-rw-r--r--tensorflow/core/BUILD4
-rw-r--r--tensorflow/core/framework/register_types.h14
-rw-r--r--tensorflow/core/kernels/batch_dataset_op.cc2
-rw-r--r--tensorflow/core/kernels/cwise_op_add_1.cc4
-rw-r--r--tensorflow/core/platform/windows/env.cc44
-rw-r--r--tensorflow/core/profiler/g3doc/python_api.md2
-rw-r--r--tensorflow/docs_src/about/roadmap.md2
-rw-r--r--tensorflow/docs_src/extend/adding_an_op.md2
-rw-r--r--tensorflow/docs_src/get_started/export.md3
-rw-r--r--tensorflow/docs_src/get_started/get_started.md16
-rw-r--r--tensorflow/docs_src/get_started/summaries_and_tensorboard.md5
-rw-r--r--tensorflow/docs_src/programmers_guide/datasets.md2
-rw-r--r--tensorflow/docs_src/tutorials/image_retraining.md4
-rw-r--r--tensorflow/docs_src/tutorials/wide_and_deep.md2
-rw-r--r--tensorflow/examples/tutorials/word2vec/word2vec_basic.py2
-rw-r--r--tensorflow/examples/udacity/5_word2vec.ipynb2
-rw-r--r--tensorflow/java/BUILD5
-rw-r--r--tensorflow/java/src/gen/perl/tftypes-runall.pl40
-rw-r--r--tensorflow/java/src/gen/perl/tftypes.pl157
-rw-r--r--tensorflow/java/src/gen/resources/tftypes.csv21
-rw-r--r--tensorflow/java/src/main/java/org/tensorflow/DataType.java8
-rw-r--r--tensorflow/java/src/main/java/org/tensorflow/types/TFBool.java30
-rw-r--r--tensorflow/java/src/main/java/org/tensorflow/types/TFDouble.java30
-rw-r--r--tensorflow/java/src/main/java/org/tensorflow/types/TFFloat.java30
-rw-r--r--tensorflow/java/src/main/java/org/tensorflow/types/TFInt32.java30
-rw-r--r--tensorflow/java/src/main/java/org/tensorflow/types/TFInt64.java30
-rw-r--r--tensorflow/java/src/main/java/org/tensorflow/types/TFString.java27
-rw-r--r--tensorflow/java/src/main/java/org/tensorflow/types/TFType.java20
-rw-r--r--tensorflow/java/src/main/java/org/tensorflow/types/TFUInt8.java30
-rw-r--r--tensorflow/java/src/main/java/org/tensorflow/types/Types.java52
-rw-r--r--tensorflow/java/src/main/java/org/tensorflow/types/package-info.java27
-rw-r--r--tensorflow/java/src/test/java/org/tensorflow/OperationTest.java1
-rw-r--r--tensorflow/python/debug/lib/debug_gradients.py2
-rw-r--r--tensorflow/python/estimator/model_fn.py2
-rw-r--r--tensorflow/python/framework/common_shapes.py2
-rw-r--r--tensorflow/python/kernel_tests/argmax_op_test.py25
-rw-r--r--tensorflow/python/layers/base.py2
-rw-r--r--tensorflow/python/ops/data_flow_ops.py5
-rw-r--r--tensorflow/python/ops/sparse_ops.py2
-rw-r--r--tensorflow/python/tools/freeze_graph.py9
-rw-r--r--tensorflow/python/tools/import_pb_to_tensorboard.py2
-rw-r--r--tensorflow/python/tools/optimize_for_inference_test.py5
-rw-r--r--tensorflow/tensorflow.bzl6
-rwxr-xr-xtensorflow/tools/ci_build/ci_sanity.sh8
-rwxr-xr-xtensorflow/tools/ci_build/code_link_check.sh42
-rwxr-xr-xtensorflow/tools/ci_build/install/install_golang.sh2
-rw-r--r--tensorflow/tools/ci_build/windows/gpu/pip/build_tf_windows.sh2
-rw-r--r--tensorflow/workspace.bzl8
-rw-r--r--tools/bazel.rc3
67 files changed, 746 insertions, 118 deletions
diff --git a/CODEOWNERS b/CODEOWNERS
index 2f216e4161..69393c3775 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -1,8 +1,9 @@
# Where component owners are known, add them here.
+tensorflow/core/platform/windows/* @mrry
+tensorflow/java/* @asimshankar
tensorflow/tensorboard/* @jart @dandelionmane
tensorflow/tools/docs/* @markdaoust
-tensorflow/java/* @asimshankar
# contrib
@@ -46,5 +47,6 @@ tensorflow/contrib/stateless/* @girving
tensorflow/contrib/tensor_forest/* @gilberthendry @thomascolthurst
tensorflow/contrib/testing/* @dandelionmane
tensorflow/contrib/timeseries/* @allenlavoie
+tensorflow/contrib/tpu/* @frankchn @saeta @jhseu
tensorflow/contrib/training/* @joel-shor @ebrevdo
tensorflow/contrib/util/* @sherrym
diff --git a/configure b/configure
index 4c6cba2169..93280dc5f5 100755
--- a/configure
+++ b/configure
@@ -26,7 +26,7 @@ function is_windows() {
}
function is_ppc64le() {
- [[ "${uname -m}" == "ppc64le" ]]
+ [[ "$(uname -m)" == "ppc64le" ]]
}
function sed_in_place() {
@@ -298,7 +298,7 @@ fi # TF_NEED_MKL
## Set up architecture-dependent optimization flags.
if [ -z "$CC_OPT_FLAGS" ]; then
- if [ is_ppc64le ]; then
+ if is_ppc64le; then
# gcc on ppc64le does not support -march, use mcpu instead
default_cc_opt_flags="-mcpu=native"
else
@@ -492,6 +492,8 @@ while true; do
if [ -z "$TF_CUDA_VERSION" ]; then
read -p "Please specify the CUDA SDK version you want to use, e.g. 7.0. [Leave empty to default to CUDA 8.0]: " TF_CUDA_VERSION
fi
+ # Set default CUDA version if not set
+ TF_CUDA_VERSION=${TF_CUDA_VERSION:-8.0}
fromuser=""
if [ -z "$CUDA_TOOLKIT_PATH" ]; then
@@ -545,11 +547,7 @@ while true; do
CUDA_TOOLKIT_PATH=""
done
-# Set default CUDA version if not set
-if [ -z "$TF_CUDA_VERSION" ]; then
- TF_CUDA_VERSION="8.0"
- export TF_CUDA_VERSION
-fi
+export TF_CUDA_VERSION
write_action_env_to_bazelrc "TF_CUDA_VERSION" "$TF_CUDA_VERSION"
# Set up which gcc nvcc should use as the host compiler
@@ -587,6 +585,8 @@ while true; do
if [ -z "$TF_CUDNN_VERSION" ]; then
read -p "Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 6.0]: " TF_CUDNN_VERSION
fi
+ # Set default CUDNN version if not set
+ TF_CUDNN_VERSION=${TF_CUDNN_VERSION:-6}
fromuser=""
if [ -z "$CUDNN_INSTALL_PATH" ]; then
@@ -659,11 +659,7 @@ while true; do
CUDNN_INSTALL_PATH=""
done
-# Set default CUDNN version if not set
-if [ -z "$TF_CUDNN_VERSION" ]; then
- TF_CUDNN_VERSION="6"
- export TF_CUDNN_VERSION
-fi
+export TF_CUDNN_VERSION
write_action_env_to_bazelrc "TF_CUDNN_VERSION" "$TF_CUDNN_VERSION"
# Configure the compute capabilities that TensorFlow builds for.
diff --git a/tensorflow/cc/framework/gradients.cc b/tensorflow/cc/framework/gradients.cc
index 29ad8a934b..d454bc3e4c 100644
--- a/tensorflow/cc/framework/gradients.cc
+++ b/tensorflow/cc/framework/gradients.cc
@@ -65,7 +65,7 @@ class SymbolicGradientBuilder {
// gradients for the node associated with `src`.
Status BackpropAlongEdge(const Output& dst_grad, const Output& src);
- // Adds a node to the graph (returned in`grad`) that sums the in-bound
+ // Adds a node to the graph (returned in `grad`) that sums the in-bound
// gradients to `src` (if there are more than one).
Status SumGradients(const Output& src, Output* grad);
diff --git a/tensorflow/compiler/tf2xla/xla_op_registry.h b/tensorflow/compiler/tf2xla/xla_op_registry.h
index 9a39cc9675..47d61a21a1 100644
--- a/tensorflow/compiler/tf2xla/xla_op_registry.h
+++ b/tensorflow/compiler/tf2xla/xla_op_registry.h
@@ -45,9 +45,10 @@ extern const char* const DEVICE_XLA_CPU;
extern const char* const DEVICE_XLA_GPU;
constexpr std::array<DataType, 2> kIntTypes = {{DT_INT32, DT_INT64}};
-constexpr std::array<DataType, 2> kFloatTypes = {{DT_FLOAT, DT_DOUBLE}};
-constexpr std::array<DataType, 4> kNumericTypes = {
- {DT_INT32, DT_INT64, DT_FLOAT, DT_DOUBLE}};
+constexpr std::array<DataType, 3> kFloatTypes = {
+ {DT_HALF, DT_FLOAT, DT_DOUBLE}};
+constexpr std::array<DataType, 5> kNumericTypes = {
+ {DT_INT32, DT_INT64, DT_HALF, DT_FLOAT, DT_DOUBLE}};
constexpr std::array<DataType, 5> kCpuAllTypes = {
{DT_INT32, DT_INT64, DT_FLOAT, DT_DOUBLE, DT_BOOL}};
diff --git a/tensorflow/compiler/xla/util.cc b/tensorflow/compiler/xla/util.cc
index b58670ecc5..3e80394fe1 100644
--- a/tensorflow/compiler/xla/util.cc
+++ b/tensorflow/compiler/xla/util.cc
@@ -15,6 +15,7 @@ limitations under the License.
#include "tensorflow/compiler/xla/util.h"
+#include <numeric>
#include <stdarg.h>
#include <numeric>
diff --git a/tensorflow/contrib/cluster_resolver/python/training/cluster_resolver.py b/tensorflow/contrib/cluster_resolver/python/training/cluster_resolver.py
index 87da24f22d..b04822fa9d 100644
--- a/tensorflow/contrib/cluster_resolver/python/training/cluster_resolver.py
+++ b/tensorflow/contrib/cluster_resolver/python/training/cluster_resolver.py
@@ -75,8 +75,8 @@ class UnionClusterResolver(ClusterResolver):
This class performs a union given two or more existing ClusterResolvers. It
merges the underlying ClusterResolvers, and returns one unified ClusterSpec
- when as_cluster_spec is called. The details of the merge function is
- documented in the as_cluster_spec function.
+ when cluster_spec is called. The details of the merge function is
+ documented in the cluster_spec function.
"""
def __init__(self, *args):
diff --git a/tensorflow/contrib/cmake/README.md b/tensorflow/contrib/cmake/README.md
index 664d0f4b6b..8ad8527559 100644
--- a/tensorflow/contrib/cmake/README.md
+++ b/tensorflow/contrib/cmake/README.md
@@ -225,7 +225,7 @@ Step-by-step Windows build
* `-Dtensorflow_ENABLE_GPU=(ON|OFF)`. Defaults to `OFF`. Include
GPU support. If GPU is enabled you need to install the CUDA 8.0 Toolkit and CUDNN 5.1.
- CMake will expect the location of CUDNN in -DCUDNN_HOME=path_you_unziped_cudnn.
+ CMake will expect the location of CUDNN in -DCUDNN_HOME=path_you_unzipped_cudnn.
* `-Dtensorflow_BUILD_CC_TESTS=(ON|OFF)`. Defaults to `OFF`. This builds cc unit tests.
There are many of them and building will take a few hours.
diff --git a/tensorflow/contrib/framework/python/ops/variables.py b/tensorflow/contrib/framework/python/ops/variables.py
index bf709f921d..411b4facdb 100644
--- a/tensorflow/contrib/framework/python/ops/variables.py
+++ b/tensorflow/contrib/framework/python/ops/variables.py
@@ -416,7 +416,7 @@ def get_unique_variable(var_op_name):
for candidate in candidates:
if candidate.op.name == var_op_name:
return candidate
- raise ValueError('Variable %s does not uniquely identify a variable',
+ raise ValueError('Variable %s does not uniquely identify a variable' %
var_op_name)
@@ -444,7 +444,7 @@ def assign_from_values(var_names_to_values):
var_value = var_names_to_values[var_name]
var = ops.get_collection(ops.GraphKeys.GLOBAL_VARIABLES, var_name)
if not var:
- raise ValueError('Variable %s wasnt found', var_name)
+ raise ValueError('Variable %s wasn\'t found' % var_name)
elif len(var) > 1:
# tf.get_collection is just a filter on the prefix: find the exact match:
found = False
@@ -455,7 +455,7 @@ def assign_from_values(var_names_to_values):
break
if not found:
- raise ValueError('Variable %s doesnt uniquely identify a variable',
+ raise ValueError('Variable %s doesn\'t uniquely identify a variable' %
var_name)
else:
var = var[0]
diff --git a/tensorflow/contrib/learn/python/learn/dataframe/transforms/boolean_mask.py b/tensorflow/contrib/learn/python/learn/dataframe/transforms/boolean_mask.py
index 130ac0c90f..874b02c6c9 100644
--- a/tensorflow/contrib/learn/python/learn/dataframe/transforms/boolean_mask.py
+++ b/tensorflow/contrib/learn/python/learn/dataframe/transforms/boolean_mask.py
@@ -35,7 +35,7 @@ def sparse_boolean_mask(sparse_tensor, mask, name="sparse_boolean_mask"):
Args:
sparse_tensor: a `SparseTensor`.
- mask: a 1D boolean dense`Tensor` whose length is equal to the 0th dimension
+ mask: a 1D boolean dense `Tensor` whose length is equal to the 0th dimension
of `sparse_tensor`.
name: optional name for this operation.
Returns:
diff --git a/tensorflow/contrib/learn/python/learn/estimators/head.py b/tensorflow/contrib/learn/python/learn/estimators/head.py
index fdc266d582..699a92d38a 100644
--- a/tensorflow/contrib/learn/python/learn/estimators/head.py
+++ b/tensorflow/contrib/learn/python/learn/estimators/head.py
@@ -25,8 +25,7 @@ import six
from tensorflow.contrib import framework as framework_lib
from tensorflow.contrib import layers as layers_lib
from tensorflow.contrib import lookup as lookup_lib
-# TODO(ptucker): Use tf.losses and tf.metrics.
-from tensorflow.contrib import losses as losses_lib
+# TODO(ptucker): Use tf.metrics.
from tensorflow.contrib import metrics as metrics_lib
from tensorflow.contrib.learn.python.learn.estimators import constants
from tensorflow.contrib.learn.python.learn.estimators import model_fn
@@ -44,6 +43,7 @@ from tensorflow.python.ops import sparse_ops
from tensorflow.python.ops import string_ops
from tensorflow.python.ops import variable_scope
from tensorflow.python.ops import weights_broadcast_ops
+from tensorflow.python.ops.losses import losses as losses_lib
from tensorflow.python.platform import tf_logging as logging
from tensorflow.python.summary import summary
from tensorflow.python.training import training
@@ -1212,7 +1212,8 @@ class _BinarySvmHead(_SingleHead):
with ops.name_scope(None, "hinge_loss", (logits, labels)) as name:
with ops.control_dependencies((_assert_labels_rank(labels),)):
labels = array_ops.reshape(labels, shape=(-1, 1))
- loss = losses_lib.hinge_loss(logits=logits, labels=labels, scope=name)
+ loss = losses_lib.hinge_loss(labels=labels, logits=logits, scope=name,
+ reduction=losses_lib.Reduction.NONE)
return _compute_weighted_loss(loss, weights)
super(_BinarySvmHead, self).__init__(
diff --git a/tensorflow/contrib/makefile/build_all_ios.sh b/tensorflow/contrib/makefile/build_all_ios.sh
index 344bf49dcf..a0f5652854 100755
--- a/tensorflow/contrib/makefile/build_all_ios.sh
+++ b/tensorflow/contrib/makefile/build_all_ios.sh
@@ -18,7 +18,7 @@ set -e
# Make sure we're on OS X.
if [[ $(uname) != "Darwin" ]]; then
- echo "ERROR: This makefile build requires OS X, which the current system "\
+ echo "ERROR: This makefile build requires macOS, which the current system "\
"is not."
exit 1
fi
@@ -37,7 +37,9 @@ rm -rf tensorflow/contrib/makefile/downloads
#
# ld: -bind_at_load and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together
#
-export MACOSX_DEPLOYMENT_TARGET="10.10"
+if [[ -n MACOSX_DEPLOYMENT_TARGET ]]; then
+ export MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion)
+fi
# Pull down the required versions of the frameworks we need.
tensorflow/contrib/makefile/download_dependencies.sh
@@ -48,6 +50,5 @@ tensorflow/contrib/makefile/compile_ios_protobuf.sh
# Build the iOS TensorFlow libraries.
tensorflow/contrib/makefile/compile_ios_tensorflow.sh "-O3"
-# Creates a static universal library in
+# Creates a static universal library in
# tensorflow/contrib/makefile/gen/lib/libtensorflow-core.a
-
diff --git a/tensorflow/contrib/makefile/compile_ios_protobuf.sh b/tensorflow/contrib/makefile/compile_ios_protobuf.sh
index e8b9454e7e..4056db18a7 100755
--- a/tensorflow/contrib/makefile/compile_ios_protobuf.sh
+++ b/tensorflow/contrib/makefile/compile_ios_protobuf.sh
@@ -15,9 +15,12 @@
# ==============================================================================
# Builds protobuf 3 for iOS.
-set -x
set -e
+if [[ -n MACOSX_DEPLOYMENT_TARGET ]]; then
+ export MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion)
+fi
+
SCRIPT_DIR=$(dirname $0)
source "${SCRIPT_DIR}/build_helper.subr"
diff --git a/tensorflow/contrib/makefile/compile_ios_tensorflow.sh b/tensorflow/contrib/makefile/compile_ios_tensorflow.sh
index bcf097b303..5d1cc8b375 100755
--- a/tensorflow/contrib/makefile/compile_ios_tensorflow.sh
+++ b/tensorflow/contrib/makefile/compile_ios_tensorflow.sh
@@ -31,6 +31,10 @@ function less_than_required_version() {
)
}
+if [[ -n MACOSX_DEPLOYMENT_TARGET ]]; then
+ export MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion)
+fi
+
ACTUAL_XCODE_VERSION=$(xcodebuild -version | head -n 1 | sed 's/Xcode //')
REQUIRED_XCODE_VERSION=7.3.0
if less_than_required_version $ACTUAL_XCODE_VERSION 7 3 0
@@ -44,7 +48,7 @@ LIBDIR=${GENDIR}lib
LIB_PREFIX=libtensorflow-core
make -j"${JOB_COUNT}" -f tensorflow/contrib/makefile/Makefile \
-TARGET=IOS IOS_ARCH=ARMV7 LIB_NAME=${LIB_PREFIX}-armv7.a OPTFLAGS="$1"
+TARGET=IOS IOS_ARCH=ARMV7 LIB_NAME=${LIB_PREFIX}-armv7.a OPTFLAGS="$1"
if [ $? -ne 0 ]
then
echo "armv7 compilation failed."
diff --git a/tensorflow/contrib/signal/python/ops/reconstruction_ops.py b/tensorflow/contrib/signal/python/ops/reconstruction_ops.py
index f5f443ad09..653c030a04 100644
--- a/tensorflow/contrib/signal/python/ops/reconstruction_ops.py
+++ b/tensorflow/contrib/signal/python/ops/reconstruction_ops.py
@@ -37,7 +37,7 @@ def _shuffle_to_front(input_tensor, k):
k: A scalar `Tensor` specifying how many indices to shuffle.
Returns:
- A tranposed version of `input_tensor` with `k` indices shuffled to the
+ A transposed version of `input_tensor` with `k` indices shuffled to the
front.
Raises:
diff --git a/tensorflow/contrib/slim/python/slim/evaluation.py b/tensorflow/contrib/slim/python/slim/evaluation.py
index 15c9f3d3f4..2d4b08df61 100644
--- a/tensorflow/contrib/slim/python/slim/evaluation.py
+++ b/tensorflow/contrib/slim/python/slim/evaluation.py
@@ -81,7 +81,7 @@ more summaries and call the evaluation_loop method:
# Evaluate every 10 minutes:
slim.evaluation_loop(
- master='',
+ '',
checkpoint_dir,
logdir,
num_evals=num_evals,
diff --git a/tensorflow/contrib/tfprof/README.md b/tensorflow/contrib/tfprof/README.md
index eefd88793e..7faf2b9b24 100644
--- a/tensorflow/contrib/tfprof/README.md
+++ b/tensorflow/contrib/tfprof/README.md
@@ -1,9 +1,9 @@
# tfprof: TensorFlow Profiler and Beyond
<h1>Please use `tf.profiler.xxx` instead of `tf.contrib.tfprof.xxx`</h1>
-<h1>Full Document in tensorflow/core/profiler/README.md<h1>
+<h1>Full Document in <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/profiler/README.md">tensorflow/core/profiler/README.md</a><h1>
-###Features
+### Features
* Profile model architectures
* parameters, tensor shapes, float operations, device placement, etc.
@@ -16,7 +16,7 @@
* operation configuration check
* distributed runtime check (Not OSS)
-###Interfaces
+### Interfaces
* Python API
* Command Line
diff --git a/tensorflow/contrib/timeseries/python/timeseries/model.py b/tensorflow/contrib/timeseries/python/timeseries/model.py
index e6c60fdf0c..f2ef8d2211 100644
--- a/tensorflow/contrib/timeseries/python/timeseries/model.py
+++ b/tensorflow/contrib/timeseries/python/timeseries/model.py
@@ -353,7 +353,7 @@ class SequentialTimeSeriesModel(TimeSeriesModel):
Args:
current_times: A [batch size] Tensor of times for each observation.
- current_values: A [batch size] Tensor of values for each observaiton.
+ current_values: A [batch size] Tensor of values for each observation.
state: Model state, updated to current_times.
predictions: The outputs of _prediction_step
Returns:
diff --git a/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py b/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py
index 3193d5607c..6a9660b400 100644
--- a/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py
+++ b/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py
@@ -391,7 +391,7 @@ class StateSpaceModel(model.SequentialTimeSeriesModel):
Args:
current_times: A [batch size] Tensor for times for each observation.
- current_values: A [batch size] Tensor of values for each observaiton.
+ current_values: A [batch size] Tensor of values for each observation.
state: A tuple of (mean, covariance, previous_times) having shapes
mean; [batch size x state dimension]
covariance; [batch size x state dimension x state dimension]
diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD
index 3d367b1b9b..870efab858 100644
--- a/tensorflow/core/BUILD
+++ b/tensorflow/core/BUILD
@@ -65,7 +65,7 @@ load(
"full_path",
"if_android",
"if_ios",
- "if_x86",
+ "if_linux_x86_64",
"if_not_mobile",
"if_not_windows",
"tf_copts",
@@ -1379,7 +1379,7 @@ cc_library(
name = "lib_hash_crc32c_accelerate_internal",
srcs = ["lib/hash/crc32c_accelerate.cc"],
# -msse4.2 enables the use of crc32c compiler builtins.
- copts = tf_copts() + if_x86(["-msse4.2"]),
+ copts = tf_copts() + if_linux_x86_64(["-msse4.2"]),
)
cc_library(
diff --git a/tensorflow/core/framework/register_types.h b/tensorflow/core/framework/register_types.h
index 3f91642064..973ad4544a 100644
--- a/tensorflow/core/framework/register_types.h
+++ b/tensorflow/core/framework/register_types.h
@@ -183,4 +183,18 @@ limitations under the License.
#define TF_CALL_QUANTIZED_TYPES(m) \
TF_CALL_qint8(m) TF_CALL_quint8(m) TF_CALL_qint32(m)
+#ifdef TENSORFLOW_SYCL_NO_DOUBLE
+#define TF_CALL_SYCL_double(m)
+#else // TENSORFLOW_SYCL_NO_DOUBLE
+#define TF_CALL_SYCL_double(m) TF_CALL_double(m)
+#endif // TENSORFLOW_SYCL_NO_DOUBLE
+
+#ifdef __ANDROID_TYPES_SLIM__
+#define TF_CALL_SYCL_NUMBER_TYPES(m) TF_CALL_float(m)
+#else // __ANDROID_TYPES_SLIM__
+#define TF_CALL_SYCL_NUMBER_TYPES(m) \
+ TF_CALL_float(m) \
+ TF_CALL_SYCL_double(m)
+#endif // __ANDROID_TYPES_SLIM__
+
#endif // TENSORFLOW_FRAMEWORK_REGISTER_TYPES_H_
diff --git a/tensorflow/core/kernels/batch_dataset_op.cc b/tensorflow/core/kernels/batch_dataset_op.cc
index 67eff44a5d..64a8e83f84 100644
--- a/tensorflow/core/kernels/batch_dataset_op.cc
+++ b/tensorflow/core/kernels/batch_dataset_op.cc
@@ -31,7 +31,7 @@ class BatchDatasetOp : public UnaryDatasetOpKernel {
void MakeDataset(OpKernelContext* ctx, DatasetBase* input,
DatasetBase** output) override {
- int64 batch_size;
+ int64 batch_size = 0;
OP_REQUIRES_OK(ctx,
ParseScalarArgument<int64>(ctx, "batch_size", &batch_size));
OP_REQUIRES(
diff --git a/tensorflow/core/kernels/cwise_op_add_1.cc b/tensorflow/core/kernels/cwise_op_add_1.cc
index acf1f2ad49..c0fe81ef55 100644
--- a/tensorflow/core/kernels/cwise_op_add_1.cc
+++ b/tensorflow/core/kernels/cwise_op_add_1.cc
@@ -36,7 +36,9 @@ REGISTER_KERNEL_BUILDER(Name("Add")
#if TENSORFLOW_USE_SYCL
-REGISTER2(BinaryOp, SYCL, "Add", functor::add, float, double);
+#define REGISTER_KERNEL(type) REGISTER(BinaryOp, SYCL, "Add", functor::add, type);
+TF_CALL_SYCL_NUMBER_TYPES(REGISTER_KERNEL);
+
REGISTER_KERNEL_BUILDER(Name("Add")
.Device(DEVICE_SYCL)
.HostMemory("x")
diff --git a/tensorflow/core/platform/windows/env.cc b/tensorflow/core/platform/windows/env.cc
index b8e1c91616..fa3d6a8301 100644
--- a/tensorflow/core/platform/windows/env.cc
+++ b/tensorflow/core/platform/windows/env.cc
@@ -82,22 +82,42 @@ class WindowsEnv : public Env {
return new StdThread(thread_options, name, fn);
}
+ static VOID CALLBACK SchedClosureCallback(PTP_CALLBACK_INSTANCE Instance,
+ PVOID Context, PTP_WORK Work) {
+ CloseThreadpoolWork(Work);
+ std::function<void()>* f = (std::function<void()>*)Context;
+ (*f)();
+ delete f;
+ }
void SchedClosure(std::function<void()> closure) override {
- // TODO(b/27290852): Spawning a new thread here is wasteful, but
- // needed to deal with the fact that many `closure` functions are
- // blocking in the current codebase.
- std::thread closure_thread(closure);
- closure_thread.detach();
+ PTP_WORK work = CreateThreadpoolWork(
+ SchedClosureCallback, new std::function<void()>(std::move(closure)),
+ nullptr);
+ SubmitThreadpoolWork(work);
+ }
+
+ static VOID CALLBACK SchedClosureAfterCallback(PTP_CALLBACK_INSTANCE Instance,
+ PVOID Context,
+ PTP_TIMER Timer) {
+ CloseThreadpoolTimer(Timer);
+ std::function<void()>* f = (std::function<void()>*)Context;
+ (*f)();
+ delete f;
}
void SchedClosureAfter(int64 micros, std::function<void()> closure) override {
- // TODO(b/27290852): Consuming a thread here is wasteful, but this
- // code is (currently) only used in the case where a step fails
- // (AbortStep). This could be replaced by a timer thread
- SchedClosure([this, micros, closure]() {
- SleepForMicroseconds(micros);
- closure();
- });
+ PTP_TIMER timer = CreateThreadpoolTimer(
+ SchedClosureAfterCallback,
+ new std::function<void()>(std::move(closure)), nullptr);
+ // in 100 nanosecond units
+ FILETIME FileDueTime;
+ ULARGE_INTEGER ulDueTime;
+ // Negative indicates the amount of time to wait is relative to the current
+ // time.
+ ulDueTime.QuadPart = (ULONGLONG) - (10 * micros);
+ FileDueTime.dwHighDateTime = ulDueTime.HighPart;
+ FileDueTime.dwLowDateTime = ulDueTime.LowPart;
+ SetThreadpoolTimer(timer, &FileDueTime, 0, 0);
}
Status LoadLibrary(const char *library_filename, void** handle) override {
diff --git a/tensorflow/core/profiler/g3doc/python_api.md b/tensorflow/core/profiler/g3doc/python_api.md
index 42a89d22a1..0daac655c4 100644
--- a/tensorflow/core/profiler/g3doc/python_api.md
+++ b/tensorflow/core/profiler/g3doc/python_api.md
@@ -24,7 +24,7 @@ opts = ProfileOptionBuilder(
).build()
param_stats = tf.profiler.profile(
tf.get_default_graph(),
- cmd='code'
+ cmd='code',
options=opts)
# param_stats can be tensorflow.tfprof.GraphNodeProto or
diff --git a/tensorflow/docs_src/about/roadmap.md b/tensorflow/docs_src/about/roadmap.md
index 1789e050fa..3ee825ed40 100644
--- a/tensorflow/docs_src/about/roadmap.md
+++ b/tensorflow/docs_src/about/roadmap.md
@@ -5,7 +5,7 @@ TensorFlow is a fast moving project. In order for the community to better
understand what the near future will bring, this document shares what we are
working on internally. Many of these features were requested by the community,
and we welcome
-[contributions](https://github.com/tensorflow/tensorflow/labels/contributions%20welcome).
+[contributions](https://github.com/tensorflow/tensorflow/labels/stat%3Acontributions%20welcome).
The features on this list are targeted for the next few months. At this point,
we do not have timelines for these features.
diff --git a/tensorflow/docs_src/extend/adding_an_op.md b/tensorflow/docs_src/extend/adding_an_op.md
index e8441d51c2..4b1d1b6e34 100644
--- a/tensorflow/docs_src/extend/adding_an_op.md
+++ b/tensorflow/docs_src/extend/adding_an_op.md
@@ -155,7 +155,7 @@ REGISTER_KERNEL_BUILDER(Name("ZeroOut").Device(DEVICE_CPU), ZeroOutOp);
### Multi-threaded CPU kernels
To write a multi-threaded CPU kernel, the Shard function in
-[`work_sharder.h`](https://www.tensorflow.org/code/tensorflow/core/framework/work_sharder.h)
+[`work_sharder.h`](https://www.tensorflow.org/code/tensorflow/core/util/work_sharder.h)
can be used. This function shards a computation function across the
threads configured to be used for intra-op threading (see
intra_op_parallelism_threads in
diff --git a/tensorflow/docs_src/get_started/export.md b/tensorflow/docs_src/get_started/export.md
index 8273030271..77e628699e 100644
--- a/tensorflow/docs_src/get_started/export.md
+++ b/tensorflow/docs_src/get_started/export.md
@@ -168,7 +168,7 @@ and so determine which request types will be honored.
> the corresponding `ExportOutput` entry. The inputs are always those provided
> by the `serving_input_receiver_fn`.
> An inference request may specify the head by name. One head must be named
-> using [`signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY`](https://www.tensorflow.org/code/saved_model/signature_constants.py)
+> using [`signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY`](https://www.tensorflow.org/code/tensorflow/python/saved_model/signature_constants.py)
> indicating which signature will be served when an inference request does not
> specify one.
@@ -295,4 +295,3 @@ the different Tensorflow Serving APIs, selecting the signature by key, etc. -->
<!-- TODO(soergel): document ExportStrategy here once Experiment moves
from contrib to core. -->
-
diff --git a/tensorflow/docs_src/get_started/get_started.md b/tensorflow/docs_src/get_started/get_started.md
index 852d41e9ed..815b83e5fb 100644
--- a/tensorflow/docs_src/get_started/get_started.md
+++ b/tensorflow/docs_src/get_started/get_started.md
@@ -32,8 +32,8 @@ tensor's **rank** is its number of dimensions. Here are some examples of
tensors:
```python
-3 # a rank 0 tensor; this is a scalar with shape []
-[1., 2., 3.] # a rank 1 tensor; this is a vector with shape [3]
+3 # a rank 0 tensor; a scalar with shape []
+[1., 2., 3.] # a rank 1 tensor; a vector with shape [3]
[[1., 2., 3.], [4., 5., 6.]] # a rank 2 tensor; a matrix with shape [2, 3]
[[[1., 2., 3.]], [[7., 8., 9.]]] # a rank 3 tensor with shape [2, 1, 3]
```
@@ -181,7 +181,7 @@ initial value:
W = tf.Variable([.3], dtype=tf.float32)
b = tf.Variable([-.3], dtype=tf.float32)
x = tf.placeholder(tf.float32)
-linear_model = W * x + b
+linear_model = W*x + b
```
Constants are initialized when you call `tf.constant`, and their value can never
@@ -302,7 +302,7 @@ W = tf.Variable([.3], dtype=tf.float32)
b = tf.Variable([-.3], dtype=tf.float32)
# Model input and output
x = tf.placeholder(tf.float32)
-linear_model = W * x + b
+linear_model = W*x + b
y = tf.placeholder(tf.float32)
# loss
@@ -330,9 +330,9 @@ When run, it produces
W: [-0.9999969] b: [ 0.99999082] loss: 5.69997e-11
```
-Notice that the loss is a very small number (very close to zero). If you run this
-program, your loss may not be the exact same because the model is initialized
-with pseudorandom values.
+Notice that the loss is a very small number (very close to zero). If you run
+this program, your loss may not be exactly the same as the aforementioned loss
+because the model is initialized with pseudorandom values.
This more complicated program can still be visualized in TensorBoard
![TensorBoard final model visualization](https://www.tensorflow.org/images/getting_started_final.png)
@@ -426,7 +426,7 @@ def model_fn(features, labels, mode):
# Build a linear model and predict values
W = tf.get_variable("W", [1], dtype=tf.float64)
b = tf.get_variable("b", [1], dtype=tf.float64)
- y = W * features['x'] + b
+ y = W*features['x'] + b
# Loss sub-graph
loss = tf.reduce_sum(tf.square(y - labels))
# Training sub-graph
diff --git a/tensorflow/docs_src/get_started/summaries_and_tensorboard.md b/tensorflow/docs_src/get_started/summaries_and_tensorboard.md
index 45d43e7a6e..ece8fbf43c 100644
--- a/tensorflow/docs_src/get_started/summaries_and_tensorboard.md
+++ b/tensorflow/docs_src/get_started/summaries_and_tensorboard.md
@@ -17,7 +17,7 @@ TensorBoard is fully configured, it looks like this:
</div>
This tutorial is intended to get you started with simple TensorBoard usage.
-There are other resources available as well! The [TensorBoard README](https://www.tensorflow.org/code/tensorflow/tensorboard/README.md)
+There are other resources available as well! The [TensorBoard's GitHub](https://github.com/tensorflow/tensorboard)
has a lot more information on TensorBoard usage, including tips & tricks, and
debugging information.
@@ -216,5 +216,4 @@ corner. Each tab represents a set of serialized data that can be visualized.
For in depth information on how to use the *graph* tab to visualize your graph,
see @{$graph_viz$TensorBoard: Graph Visualization}.
-For more usage information on TensorBoard in general, see the [TensorBoard
-README](https://www.tensorflow.org/code/tensorflow/tensorboard/README.md).
+For more usage information on TensorBoard in general, see the [TensorBoard's GitHub](https://github.com/tensorflow/tensorboard).
diff --git a/tensorflow/docs_src/programmers_guide/datasets.md b/tensorflow/docs_src/programmers_guide/datasets.md
index ddf5388ac2..68ed4bcd47 100644
--- a/tensorflow/docs_src/programmers_guide/datasets.md
+++ b/tensorflow/docs_src/programmers_guide/datasets.md
@@ -447,7 +447,7 @@ dataset = tf.contrib.data.Dataset.from_tensor_slices(filenames)
# * Filter out lines beginning with "#" (comments).
dataset = dataset.flat_map(
lambda filename: (
- tf.contrib.data.Dataset.TextLineDataset(filename)
+ tf.contrib.data.TextLineDataset(filename)
.skip(1)
.filter(lambda line: tf.not_equal(tf.substr(line, 0, 1), "#"))))
```
diff --git a/tensorflow/docs_src/tutorials/image_retraining.md b/tensorflow/docs_src/tutorials/image_retraining.md
index 898db0e73c..b0e715edcb 100644
--- a/tensorflow/docs_src/tutorials/image_retraining.md
+++ b/tensorflow/docs_src/tutorials/image_retraining.md
@@ -137,7 +137,7 @@ Once TensorBoard is running, navigate your web browser to `localhost:6006` to vi
The script will log TensorBoard summaries to `/tmp/retrain_logs` by default. You can change the directory with the `--summaries_dir` flag.
-The [TensorBoard README](https://www.tensorflow.org/code/tensorflow/tensorboard/README.md) has a lot more information on TensorBoard usage, including tips & tricks, and debugging information.
+The [TensorBoard's GitHub](https://github.com/tensorflow/tensorboard) has a lot more information on TensorBoard usage, including tips & tricks, and debugging information.
## Using the Retrained Model
@@ -337,7 +337,7 @@ the (much larger) training set.
By default the script uses a pretrained version of the Inception v3 model
architecture. This is a good place to start because it provides high accuracy
-results, but if you intend to deploy your model on mobile devices or other
+results, but if you intend to deploy your model on mobile devices or other
resource-constrained environments you may want to trade off a little accuracy
for much smaller file sizes or faster speeds. To help with that, the
[retrain.py script](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py)
diff --git a/tensorflow/docs_src/tutorials/wide_and_deep.md b/tensorflow/docs_src/tutorials/wide_and_deep.md
index 64b3fa7dbf..e6344405d5 100644
--- a/tensorflow/docs_src/tutorials/wide_and_deep.md
+++ b/tensorflow/docs_src/tutorials/wide_and_deep.md
@@ -87,7 +87,7 @@ education = tf.feature_column.categorical_column_with_vocabulary_list(
"Doctorate", "Prof-school", "5th-6th", "10th", "1st-4th",
"Preschool", "12th"
])
-tf.feature_column.categorical_column_with_vocabulary_list(
+marital_status = tf.feature_column.categorical_column_with_vocabulary_list(
"marital_status", [
"Married-civ-spouse", "Divorced", "Married-spouse-absent",
"Never-married", "Separated", "Married-AF-spouse", "Widowed"
diff --git a/tensorflow/examples/tutorials/word2vec/word2vec_basic.py b/tensorflow/examples/tutorials/word2vec/word2vec_basic.py
index aee482fda5..e67442b14b 100644
--- a/tensorflow/examples/tutorials/word2vec/word2vec_basic.py
+++ b/tensorflow/examples/tutorials/word2vec/word2vec_basic.py
@@ -253,7 +253,7 @@ try:
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
- tsne = TSNE(perplexity=30, n_components=2, init='pca', n_iter=5000)
+ tsne = TSNE(perplexity=30, n_components=2, init='pca', n_iter=5000, method='exact')
plot_only = 500
low_dim_embs = tsne.fit_transform(final_embeddings[:plot_only, :])
labels = [reverse_dictionary[i] for i in xrange(plot_only)]
diff --git a/tensorflow/examples/udacity/5_word2vec.ipynb b/tensorflow/examples/udacity/5_word2vec.ipynb
index 9d4243d7ae..18c456cad7 100644
--- a/tensorflow/examples/udacity/5_word2vec.ipynb
+++ b/tensorflow/examples/udacity/5_word2vec.ipynb
@@ -806,7 +806,7 @@
"source": [
"num_points = 400\n",
"\n",
- "tsne = TSNE(perplexity=30, n_components=2, init='pca', n_iter=5000)\n",
+ "tsne = TSNE(perplexity=30, n_components=2, init='pca', n_iter=5000, method='exact')\n",
"two_d_embeddings = tsne.fit_transform(final_embeddings[1:num_points+1, :])"
],
"outputs": [],
diff --git a/tensorflow/java/BUILD b/tensorflow/java/BUILD
index 759f4c1b0e..9fb4821cb1 100644
--- a/tensorflow/java/BUILD
+++ b/tensorflow/java/BUILD
@@ -22,7 +22,10 @@ java_library(
# .aar. At some point, might make sense for a .aar rule here instead.
filegroup(
name = "java_sources",
- srcs = glob(["src/main/java/org/tensorflow/*.java"]),
+ srcs = glob([
+ "src/main/java/org/tensorflow/*.java",
+ "src/main/java/org/tensorflow/types/*.java",
+ ]),
visibility = [
"//tensorflow/contrib/android:__pkg__",
"//tensorflow/java:__pkg__",
diff --git a/tensorflow/java/src/gen/perl/tftypes-runall.pl b/tensorflow/java/src/gen/perl/tftypes-runall.pl
new file mode 100644
index 0000000000..258c1ff836
--- /dev/null
+++ b/tensorflow/java/src/gen/perl/tftypes-runall.pl
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+#
+# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# =============================================================================
+
+my $script = $0;
+my $dir = `dirname $script`;
+chomp $dir;
+my $gen = "$dir/..";
+my $tfjavasrc = "$gen/..";
+my $rsrc = "$gen/resources";
+my $root = "$tfjavasrc/main/java";
+my $pkg = "$root/org/tensorflow";
+
+sub locchk {
+ (my $f) = @_;
+ if (! -r $f) {
+ print STDERR "Script tftypes-runall seems to be located in the wrong place (could not find $f)\n";
+ exit 1;
+ }
+}
+&locchk("$gen");
+&locchk("$tfjavasrc/gen");
+&locchk("$dir/tftypes.pl");
+&locchk("$rsrc/tftypes.csv");
+
+system("perl $dir/tftypes.pl -t $rsrc/tftypes.csv $pkg/types");
+# system("perl $dir/tftypes.pl -c $rsrc/tftypes.csv $rsrc/Tensors.java.tmpl > $pkg/op/Tensors.java");
diff --git a/tensorflow/java/src/gen/perl/tftypes.pl b/tensorflow/java/src/gen/perl/tftypes.pl
new file mode 100644
index 0000000000..86867335cb
--- /dev/null
+++ b/tensorflow/java/src/gen/perl/tftypes.pl
@@ -0,0 +1,157 @@
+#!/usr/bin/perl
+#
+# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# =============================================================================
+
+use strict;
+
+my $copyright =
+'/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+';
+
+my $count;
+
+my $option = '-t', my $template;
+
+sub usage {
+ print "Usage: tftypes [-ctdT] <type desc file> <tmpl file>\n\n"
+ ."This script generates parts of various .java files that depend on which"
+ ."TensorFlow types are supported by the Java API and how much. For each"
+ ."such .java file, there is a .tmpl file in the same source directory in"
+ ."which the strings \@TYPEINFO\@ and \@IMPORTS\@ are replaced with"
+ ."appropriate Java code. Output code is sent to standard output.\n\n";
+
+ print "Modulo putting in the correct directory names, it can be invoked as follows:\n";
+ print "tftypes -c tftypes.csv Tensors.java.tmpl > Tensors.java\n";
+ print "tftypes -t tftypes.csv <dir> [outputs files to dir]\n";
+}
+
+if ($ARGV[0] =~ m/^-/) {
+ $option = shift;
+}
+my $typedesc = shift;
+my $tmpl = shift;
+
+my $dirname;
+
+if ($option eq '-t') {
+ $dirname = $tmpl;
+}
+
+open (TMPL, "<$tmpl") || die "Cannot open $tmpl for reading\n";
+
+my $text = do { local $/; <TMPL> };
+
+my %jtypecount;
+
+my $typeinfo, my $imports;
+
+open (TYPEDESC, $typedesc);
+
+my @info = ([]);
+
+while (<TYPEDESC>) {
+ chomp;
+ my $line = $_;
+ if ($line =~ m/^TF type/) { next }
+ $line =~ s/\r$//;
+ (my $name, my $jtype, my $creat, my $default, my $desc) =
+ split /,/, $line, 5;
+ $desc =~ s/^ *//g;
+ $desc =~ s/ *$//g;
+ $jtypecount{$jtype}++;
+ if ($jtypecount{$jtype} > 1) {
+# currently allowing Java types to stand for more than one TF type, but
+# may want to revisit this.
+# print STDERR "Ambiguous Java type for $name : $jtype\n";
+# exit 1
+ }
+
+ push @info, [$name, $jtype, $creat, $default, $desc];
+}
+
+for (my $i = 1; $i <= $#info; $i++) {
+ (my $name, my $jtype, my $creat, my $default, my $desc) =
+ @{$info[$i]};
+ my $tfname = "TF".$name;
+ my $ucname = uc $name;
+
+ if ($option eq '-t') {
+ if ($jtype eq '') { next }
+ # Generate class declarations
+ # print STDERR "Creating $dirname/$tfname.java\n";
+ open (CLASSFILE, ">$dirname/$tfname.java") || die "Can't open $tfname.java";
+ print CLASSFILE $copyright;
+ print CLASSFILE "// GENERATED FILE. To update, edit tftypes.pl instead.\n\n";
+
+ my $fulldesc = $desc;
+ if (substr($desc, 0, 1) =~ m/^[aeoiu8]$/i) {
+ $fulldesc = "an $desc"
+ } else {
+ $fulldesc = "a $desc"
+ }
+ print CLASSFILE "package org.tensorflow.types;\n\n"
+ ."import org.tensorflow.DataType;\n\n";
+ print CLASSFILE "/** Represents $fulldesc. */\n"
+ ."public class $tfname implements TFType {\n"
+ ." private $tfname() {}\n"
+ ." static {\n"
+ ." Types.typeCodes.put($tfname.class, DataType.$ucname);\n"
+ ." }\n";
+ if ($default ne '') {
+ print CLASSFILE
+ " static {\n"
+ ." Types.scalars.put($tfname.class, $default);\n"
+ ." }\n";
+ }
+ print CLASSFILE "}\n";
+ close(CLASSFILE);
+ } elsif ($option eq '-c') {
+ # Generate creator declarations for Tensors.java
+ if ($jtype ne '' && $creat eq 'y') {
+ for (my $brackets = ''; length $brackets <= 12; $brackets .= '[]') {
+ $typeinfo .=
+ " public static Tensor<$tfname> create($jtype$brackets data) {\n"
+ ." return Tensor.create(data, $tfname.class);\n"
+ ." }\n";
+ }
+ }
+ if ($text =~ m/\b$tfname\b/ || $creat eq 'y') {
+ $imports .= "import org.tensorflow.types.$tfname;\n";
+ }
+ }
+}
+
+if ($option ne '-t') {
+ print "// GENERATED FILE. Edits to this file will be lost -- edit $tmpl instead.\n";
+
+ $text =~ s/\@TYPEINFO\@/$typeinfo/;
+ $text =~ s/\@IMPORTS\@/$imports/;
+
+ print $text;
+}
diff --git a/tensorflow/java/src/gen/resources/tftypes.csv b/tensorflow/java/src/gen/resources/tftypes.csv
new file mode 100644
index 0000000000..88acaafd3c
--- /dev/null
+++ b/tensorflow/java/src/gen/resources/tftypes.csv
@@ -0,0 +1,21 @@
+TF type,Java type,Creator?,Zero value,Description
+Float,float,y,0f,32-bit single precision floating point number
+Double,double,y,0.0,64-bit double precision floating point number
+Int32,int,y,0,32-bit signed integer
+UInt8,byte,n,(byte)0,8-bit unsigned integer
+Int16,,n,(short)0,16-bit signed integer
+Int8,,n,(byte)0,8-bit signed integer
+String,byte,n,,arbitrary sequence of bytes
+Complex64,,n,,single-precision complex number
+Int64,long,y,0L,64-bit signed integer
+Bool,boolean,y,false,boolean
+QInt8,,n,,quantized int8
+QUInt8,,n,,quantized uint8
+QInt32,,n,,quantized int32
+BFloat16,,n,,float32 truncated to 16 bits. Only for cast ops.
+QInt16,,n,,quantized int16
+QUInt16,,n,,quantized uint16
+UInt16,,n,,16-bit unsigned integer
+Complex128,,n,,double-precision complex number
+Half,,n,,
+Resource,,n,,
diff --git a/tensorflow/java/src/main/java/org/tensorflow/DataType.java b/tensorflow/java/src/main/java/org/tensorflow/DataType.java
index cafa3ffc7d..e67e266ff7 100644
--- a/tensorflow/java/src/main/java/org/tensorflow/DataType.java
+++ b/tensorflow/java/src/main/java/org/tensorflow/DataType.java
@@ -53,12 +53,14 @@ public enum DataType {
int c() {
return value;
}
+
+ // Cached to avoid copying it
+ final private static DataType[] values = values();
static DataType fromC(int c) {
- for (DataType t : DataType.values()) {
- if (t.c() == c) {
+ for (DataType t : values) {
+ if (t.value == c)
return t;
- }
}
throw new IllegalArgumentException(
"DataType " + c + " is not recognized in Java (version " + TensorFlow.version() + ")");
diff --git a/tensorflow/java/src/main/java/org/tensorflow/types/TFBool.java b/tensorflow/java/src/main/java/org/tensorflow/types/TFBool.java
new file mode 100644
index 0000000000..ab34f6aa12
--- /dev/null
+++ b/tensorflow/java/src/main/java/org/tensorflow/types/TFBool.java
@@ -0,0 +1,30 @@
+/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+// GENERATED FILE. To update, edit tftypes.pl instead.
+
+package org.tensorflow.types;
+
+import org.tensorflow.DataType;
+
+/** Represents a boolean. */
+public class TFBool implements TFType {
+ private TFBool() {}
+ static {
+ Types.typeCodes.put(TFBool.class, DataType.BOOL);
+ }
+ static {
+ Types.scalars.put(TFBool.class, false);
+ }
+}
diff --git a/tensorflow/java/src/main/java/org/tensorflow/types/TFDouble.java b/tensorflow/java/src/main/java/org/tensorflow/types/TFDouble.java
new file mode 100644
index 0000000000..49e5d9f2f3
--- /dev/null
+++ b/tensorflow/java/src/main/java/org/tensorflow/types/TFDouble.java
@@ -0,0 +1,30 @@
+/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+// GENERATED FILE. To update, edit tftypes.pl instead.
+
+package org.tensorflow.types;
+
+import org.tensorflow.DataType;
+
+/** Represents a 64-bit double precision floating point number. */
+public class TFDouble implements TFType {
+ private TFDouble() {}
+ static {
+ Types.typeCodes.put(TFDouble.class, DataType.DOUBLE);
+ }
+ static {
+ Types.scalars.put(TFDouble.class, 0.0);
+ }
+}
diff --git a/tensorflow/java/src/main/java/org/tensorflow/types/TFFloat.java b/tensorflow/java/src/main/java/org/tensorflow/types/TFFloat.java
new file mode 100644
index 0000000000..8426ee41f0
--- /dev/null
+++ b/tensorflow/java/src/main/java/org/tensorflow/types/TFFloat.java
@@ -0,0 +1,30 @@
+/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+// GENERATED FILE. To update, edit tftypes.pl instead.
+
+package org.tensorflow.types;
+
+import org.tensorflow.DataType;
+
+/** Represents a 32-bit single precision floating point number. */
+public class TFFloat implements TFType {
+ private TFFloat() {}
+ static {
+ Types.typeCodes.put(TFFloat.class, DataType.FLOAT);
+ }
+ static {
+ Types.scalars.put(TFFloat.class, 0f);
+ }
+}
diff --git a/tensorflow/java/src/main/java/org/tensorflow/types/TFInt32.java b/tensorflow/java/src/main/java/org/tensorflow/types/TFInt32.java
new file mode 100644
index 0000000000..3947b6ad09
--- /dev/null
+++ b/tensorflow/java/src/main/java/org/tensorflow/types/TFInt32.java
@@ -0,0 +1,30 @@
+/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+// GENERATED FILE. To update, edit tftypes.pl instead.
+
+package org.tensorflow.types;
+
+import org.tensorflow.DataType;
+
+/** Represents a 32-bit signed integer. */
+public class TFInt32 implements TFType {
+ private TFInt32() {}
+ static {
+ Types.typeCodes.put(TFInt32.class, DataType.INT32);
+ }
+ static {
+ Types.scalars.put(TFInt32.class, 0);
+ }
+}
diff --git a/tensorflow/java/src/main/java/org/tensorflow/types/TFInt64.java b/tensorflow/java/src/main/java/org/tensorflow/types/TFInt64.java
new file mode 100644
index 0000000000..ccdded8693
--- /dev/null
+++ b/tensorflow/java/src/main/java/org/tensorflow/types/TFInt64.java
@@ -0,0 +1,30 @@
+/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+// GENERATED FILE. To update, edit tftypes.pl instead.
+
+package org.tensorflow.types;
+
+import org.tensorflow.DataType;
+
+/** Represents a 64-bit signed integer. */
+public class TFInt64 implements TFType {
+ private TFInt64() {}
+ static {
+ Types.typeCodes.put(TFInt64.class, DataType.INT64);
+ }
+ static {
+ Types.scalars.put(TFInt64.class, 0L);
+ }
+}
diff --git a/tensorflow/java/src/main/java/org/tensorflow/types/TFString.java b/tensorflow/java/src/main/java/org/tensorflow/types/TFString.java
new file mode 100644
index 0000000000..e7327e8c57
--- /dev/null
+++ b/tensorflow/java/src/main/java/org/tensorflow/types/TFString.java
@@ -0,0 +1,27 @@
+/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+// GENERATED FILE. To update, edit tftypes.pl instead.
+
+package org.tensorflow.types;
+
+import org.tensorflow.DataType;
+
+/** Represents an arbitrary sequence of bytes. */
+public class TFString implements TFType {
+ private TFString() {}
+ static {
+ Types.typeCodes.put(TFString.class, DataType.STRING);
+ }
+}
diff --git a/tensorflow/java/src/main/java/org/tensorflow/types/TFType.java b/tensorflow/java/src/main/java/org/tensorflow/types/TFType.java
new file mode 100644
index 0000000000..562953ac9d
--- /dev/null
+++ b/tensorflow/java/src/main/java/org/tensorflow/types/TFType.java
@@ -0,0 +1,20 @@
+/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+package org.tensorflow.types;
+
+/**
+ * A marker interface for classes representing TensorFlow types.
+ */
+public interface TFType {}
diff --git a/tensorflow/java/src/main/java/org/tensorflow/types/TFUInt8.java b/tensorflow/java/src/main/java/org/tensorflow/types/TFUInt8.java
new file mode 100644
index 0000000000..d7305ca5a8
--- /dev/null
+++ b/tensorflow/java/src/main/java/org/tensorflow/types/TFUInt8.java
@@ -0,0 +1,30 @@
+/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+// GENERATED FILE. To update, edit tftypes.pl instead.
+
+package org.tensorflow.types;
+
+import org.tensorflow.DataType;
+
+/** Represents an 8-bit unsigned integer. */
+public class TFUInt8 implements TFType {
+ private TFUInt8() {}
+ static {
+ Types.typeCodes.put(TFUInt8.class, DataType.UINT8);
+ }
+ static {
+ Types.scalars.put(TFUInt8.class, (byte)0);
+ }
+}
diff --git a/tensorflow/java/src/main/java/org/tensorflow/types/Types.java b/tensorflow/java/src/main/java/org/tensorflow/types/Types.java
new file mode 100644
index 0000000000..976cd9fd34
--- /dev/null
+++ b/tensorflow/java/src/main/java/org/tensorflow/types/Types.java
@@ -0,0 +1,52 @@
+/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+package org.tensorflow.types;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.tensorflow.DataType;
+
+/**
+ * Utility class for managing the representation of TensorFlow types as Java
+ * types. For each TensorFlow type (e.g., int32), there is a corresponding Java
+ * type (e.g., TFInt32) that represents it at compile time and a corresponding
+ * class object (e.g., TFInt32.class) that represents it at run time. There is
+ * also an enumeration value in DataType that can be used to represent the
+ * type, though that should rarely be required.
+ */
+public class Types {
+
+ private Types() {} // not instantiable
+
+ static final Map<Class<?>, DataType> typeCodes = new HashMap<>();
+
+ /** Returns the DataType value corresponding to a TensorFlow type class. */
+ public static DataType dataType(Class<? extends TFType> c) {
+ DataType dtype = typeCodes.get(c);
+ if (dtype == null) {
+ throw new IllegalArgumentException("" + c + " is not a TensorFlow type.");
+ }
+ return dtype;
+ }
+
+ static final Map<Class<?>, Object> scalars = new HashMap<>();
+
+ /** Returns the zero value of type described by {@code c}, or null if
+ * the type (e.g., string) is not numeric and therefore has no zero value.
+ */
+ public static Object zeroValue(Class<? extends TFType> c) {
+ return scalars.get(c);
+ }
+}
diff --git a/tensorflow/java/src/main/java/org/tensorflow/types/package-info.java b/tensorflow/java/src/main/java/org/tensorflow/types/package-info.java
new file mode 100644
index 0000000000..f1410a760e
--- /dev/null
+++ b/tensorflow/java/src/main/java/org/tensorflow/types/package-info.java
@@ -0,0 +1,27 @@
+/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+/**
+ * Defines classes that represent TensorFlow data types. For each possible data type
+ * that can be used in a tensor, there is a corresponding class in this package that
+ * is used to represent it. For example, the TensorFlow int32 type is represented by
+ * the type TFInt32 and by the class object TFInt32.class. The former is used to
+ * support compile-time checking of tensor data types and the latter is used for
+ * run-time checking of data types. All such classes implement the TFType interface.
+ * TensorFlow data types are also separately represented by the DataType enum, with
+ * one enum value per data type. The enum representation should rarely be needed, but
+ * the Types class can be used to obtain it from the class object representation.
+ */
+package org.tensorflow.types;
diff --git a/tensorflow/java/src/test/java/org/tensorflow/OperationTest.java b/tensorflow/java/src/test/java/org/tensorflow/OperationTest.java
index 23b5abc077..aade375db8 100644
--- a/tensorflow/java/src/test/java/org/tensorflow/OperationTest.java
+++ b/tensorflow/java/src/test/java/org/tensorflow/OperationTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.fail;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
diff --git a/tensorflow/python/debug/lib/debug_gradients.py b/tensorflow/python/debug/lib/debug_gradients.py
index e5159cb941..6655f85d3a 100644
--- a/tensorflow/python/debug/lib/debug_gradients.py
+++ b/tensorflow/python/debug/lib/debug_gradients.py
@@ -303,7 +303,7 @@ class GradientsDebugger(object):
"""Register the gradient tensor for an x-tensor.
Args:
- x_tensor_name: (`str`) the name of the the independent `tf.Tensor`, i.e.,
+ x_tensor_name: (`str`) the name of the independent `tf.Tensor`, i.e.,
the tensor on the denominator of the differentiation.
gradient_tensor: the gradient `tf.Tensor`.
"""
diff --git a/tensorflow/python/estimator/model_fn.py b/tensorflow/python/estimator/model_fn.py
index 9d0e2c3381..1a023c971f 100644
--- a/tensorflow/python/estimator/model_fn.py
+++ b/tensorflow/python/estimator/model_fn.py
@@ -78,7 +78,7 @@ class EstimatorSpec(
Depending on the value of `mode`, different arguments are required. Namely
* For `mode == ModeKeys.TRAIN`: required fields are `loss` and `train_op`.
- * For `mode == ModeKeys.EVAL`: required field is`loss`.
+ * For `mode == ModeKeys.EVAL`: required field is `loss`.
* For `mode == ModeKeys.PREDICT`: required fields are `predictions`.
model_fn can populate all arguments independent of mode. In this case, some
diff --git a/tensorflow/python/framework/common_shapes.py b/tensorflow/python/framework/common_shapes.py
index 79bf0879d7..52a0b9baa6 100644
--- a/tensorflow/python/framework/common_shapes.py
+++ b/tensorflow/python/framework/common_shapes.py
@@ -617,7 +617,7 @@ def call_cpp_shape_fn(op, require_shape_fn=True):
def _call_cpp_shape_fn_impl(
op, input_tensors_needed, input_tensors_as_shapes_needed, require_shape_fn):
- """Core implementaton of call_cpp_shape_fn."""
+ """Core implementation of call_cpp_shape_fn."""
graph_def_version = op.graph.graph_def_versions.producer
node_def_str = op.node_def.SerializeToString()
diff --git a/tensorflow/python/kernel_tests/argmax_op_test.py b/tensorflow/python/kernel_tests/argmax_op_test.py
index ae171dec55..ce06769902 100644
--- a/tensorflow/python/kernel_tests/argmax_op_test.py
+++ b/tensorflow/python/kernel_tests/argmax_op_test.py
@@ -29,12 +29,12 @@ class ArgMaxTest(test.TestCase):
def _testArg(self,
method,
x,
- dimension,
+ axis,
expected_values,
use_gpu=False,
expected_err_re=None):
with self.test_session(use_gpu=use_gpu):
- ans = method(x, dimension=dimension)
+ ans = method(x, axis=axis)
if expected_err_re is None:
tf_ans = ans.eval()
# Defaults to int64 output.
@@ -48,27 +48,26 @@ class ArgMaxTest(test.TestCase):
def _testBothArg(self,
method,
x,
- dimension,
+ axis,
expected_values,
expected_err_re=None):
- self._testArg(method, x, dimension, expected_values, True, expected_err_re)
- self._testArg(method, x, dimension, expected_values, False, expected_err_re)
+ self._testArg(method, x, axis, expected_values, True, expected_err_re)
+ self._testArg(method, x, axis, expected_values, False, expected_err_re)
def _testBasic(self, dtype):
x = np.asarray(100 * np.random.randn(200), dtype=dtype)
- # Check that argmin and argmax match numpy along the primary
- # dimension
+ # Check that argmin and argmax match numpy along the primary axis
self._testBothArg(math_ops.argmax, x, 0, x.argmax())
self._testBothArg(math_ops.argmin, x, 0, x.argmin())
def _testDim(self, dtype):
x = np.asarray(100 * np.random.randn(3, 2, 4, 5, 6), dtype=dtype)
- # Check that argmin and argmax match numpy along all dimensions
- for dim in range(-5, 5):
- self._testBothArg(math_ops.argmax, x, dim, x.argmax(dim))
- self._testBothArg(math_ops.argmin, x, dim, x.argmin(dim))
+ # Check that argmin and argmax match numpy along all axes
+ for axis in range(-5, 5):
+ self._testBothArg(math_ops.argmax, x, axis, x.argmax(axis))
+ self._testBothArg(math_ops.argmin, x, axis, x.argmin(axis))
def testFloat(self):
self._testBasic(np.float32)
@@ -78,7 +77,7 @@ class ArgMaxTest(test.TestCase):
x = np.asarray(100 * np.random.randn(200), dtype=np.float32)
expected_values = x.argmax()
with self.test_session(use_gpu=True):
- ans = math_ops.argmax(x, dimension=0, output_type=dtypes.int32)
+ ans = math_ops.argmax(x, axis=0, output_type=dtypes.int32)
tf_ans = ans.eval()
self.assertEqual(np.int32, tf_ans.dtype)
# The values are equal when comparing int32 to int64 because
@@ -86,7 +85,7 @@ class ArgMaxTest(test.TestCase):
self.assertAllEqual(tf_ans, expected_values)
expected_values = x.argmin()
with self.test_session(use_gpu=True):
- ans = math_ops.argmin(x, dimension=0, output_type=dtypes.int32)
+ ans = math_ops.argmin(x, axis=0, output_type=dtypes.int32)
tf_ans = ans.eval()
self.assertEqual(np.int32, tf_ans.dtype)
self.assertAllEqual(tf_ans, expected_values)
diff --git a/tensorflow/python/layers/base.py b/tensorflow/python/layers/base.py
index ebf108d8ca..9e5772b891 100644
--- a/tensorflow/python/layers/base.py
+++ b/tensorflow/python/layers/base.py
@@ -537,7 +537,7 @@ class Layer(object):
if x.get_shape().ndims is None:
raise ValueError('Input ' + str(input_index) + ' of layer ' +
self.name + ' is incompatible with the layer: '
- 'its rank is undefined, by the layer requires a '
+ 'its rank is undefined, but the layer requires a '
'defined rank.')
# Check ndim.
diff --git a/tensorflow/python/ops/data_flow_ops.py b/tensorflow/python/ops/data_flow_ops.py
index 3ff93b61c5..e22cab86c8 100644
--- a/tensorflow/python/ops/data_flow_ops.py
+++ b/tensorflow/python/ops/data_flow_ops.py
@@ -512,8 +512,9 @@ class QueueBase(object):
the given queue. Subsequent `enqueue` and `enqueue_many`
operations will fail. Subsequent `dequeue` and `dequeue_many`
operations will continue to succeed if sufficient elements remain
- in the queue. Subsequent `dequeue` and `dequeue_many` operations
- that would block will fail immediately.
+ in the queue. Subsequently dequeue and dequeue_many operations
+ that would otherwise block waiting for more elements (if close
+ hadn't been called) will now fail immediately.
If `cancel_pending_enqueues` is `True`, all pending requests will also
be canceled.
diff --git a/tensorflow/python/ops/sparse_ops.py b/tensorflow/python/ops/sparse_ops.py
index d05fabce86..db33541218 100644
--- a/tensorflow/python/ops/sparse_ops.py
+++ b/tensorflow/python/ops/sparse_ops.py
@@ -1110,7 +1110,7 @@ def sparse_merge(sp_ids, sp_values, vocab_size, name=None,
Args:
sp_ids: A single `SparseTensor` with `values` property of type `int32`
or `int64` or a Python list of such `SparseTensor`s or a list thereof.
- sp_values: A`SparseTensor` of any type.
+ sp_values: A `SparseTensor` of any type.
vocab_size: A scalar `int64` Tensor (or Python int) containing the new size
of the last dimension, `all(0 <= sp_ids.values < vocab_size)`.
Or a list thereof with `all(0 <= sp_ids[i].values < vocab_size[i])` for
diff --git a/tensorflow/python/tools/freeze_graph.py b/tensorflow/python/tools/freeze_graph.py
index bd046a7fd0..8069950925 100644
--- a/tensorflow/python/tools/freeze_graph.py
+++ b/tensorflow/python/tools/freeze_graph.py
@@ -115,10 +115,15 @@ def freeze_graph_with_def_protos(
output_node_names.split(","),
variable_names_blacklist=variable_names_blacklist)
- with gfile.GFile(output_graph, "wb") as f:
- f.write(output_graph_def.SerializeToString())
+ # Write GraphDef to file if output path has been given.
+ if output_graph:
+ with gfile.GFile(output_graph, "wb") as f:
+ f.write(output_graph_def.SerializeToString())
+
print("%d ops in the final graph." % len(output_graph_def.node))
+ return output_graph_def
+
def _parse_input_graph_proto(input_graph, input_binary):
"""Parser input tensorflow graph into GraphDef proto."""
diff --git a/tensorflow/python/tools/import_pb_to_tensorboard.py b/tensorflow/python/tools/import_pb_to_tensorboard.py
index 2cab409cfb..a8712fc37e 100644
--- a/tensorflow/python/tools/import_pb_to_tensorboard.py
+++ b/tensorflow/python/tools/import_pb_to_tensorboard.py
@@ -64,11 +64,13 @@ if __name__ == "__main__":
"--model_dir",
type=str,
default="",
+ required=True,
help="The location of the protobuf (\'pb\') model to visualize.")
parser.add_argument(
"--log_dir",
type=str,
default="",
+ required=True,
help="The location for the Tensorboard log to begin visualization from.")
FLAGS, unparsed = parser.parse_known_args()
app.run(main=main, argv=[sys.argv[0]] + unparsed)
diff --git a/tensorflow/python/tools/optimize_for_inference_test.py b/tensorflow/python/tools/optimize_for_inference_test.py
index e547d0e292..447057cfe9 100644
--- a/tensorflow/python/tools/optimize_for_inference_test.py
+++ b/tensorflow/python/tools/optimize_for_inference_test.py
@@ -271,7 +271,8 @@ class OptimizeForInferenceTest(test.TestCase):
for node in optimized_graph_def.node:
self.assertNotEqual("Conv2D", node.op)
- self.assertNotEqual("ResizeBilinear", node.op)
+ self.assertNotEqual("MirrorPad", node.op)
+
def testFusePadAndConv(self):
with self.test_session() as sess:
@@ -299,7 +300,7 @@ class OptimizeForInferenceTest(test.TestCase):
for node in optimized_graph_def.node:
self.assertNotEqual("Conv2D", node.op)
- self.assertNotEqual("MirrorPad", node.op)
+ self.assertNotEqual("ResizeBilinear", node.op)
if __name__ == "__main__":
diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl
index 83a9313e50..cddf16f147 100644
--- a/tensorflow/tensorflow.bzl
+++ b/tensorflow/tensorflow.bzl
@@ -117,11 +117,9 @@ def if_not_windows(a):
})
-def if_x86(a):
+def if_linux_x86_64(a):
return select({
clean_dep("//tensorflow:linux_x86_64"): a,
- clean_dep("//tensorflow:windows"): a,
- clean_dep("//tensorflow:windows_msvc"): a,
"//conditions:default": [],
})
@@ -152,7 +150,7 @@ def tf_copts():
"-Wno-sign-compare",
"-fno-exceptions",
]) + if_cuda(["-DGOOGLE_CUDA=1"]) + if_mkl(["-DINTEL_MKL=1", "-fopenmp",]) + if_android_arm(
- ["-mfpu=neon"]) + if_x86(["-msse3"]) + select({
+ ["-mfpu=neon"]) + if_linux_x86_64(["-msse3"]) + select({
clean_dep("//tensorflow:android"): [
"-std=c++11",
"-DTF_LEAN_BINARY",
diff --git a/tensorflow/tools/ci_build/ci_sanity.sh b/tensorflow/tools/ci_build/ci_sanity.sh
index 5bea031b68..82b41d4f9d 100755
--- a/tensorflow/tools/ci_build/ci_sanity.sh
+++ b/tensorflow/tools/ci_build/ci_sanity.sh
@@ -418,6 +418,10 @@ do_pip_smoke_test() {
"The pip smoke test failed."
}
+do_code_link_check() {
+ tensorflow/tools/ci_build/code_link_check.sh
+}
+
do_check_load_py_test() {
BUILD_CMD="bazel build //tensorflow/tools/pip_package:check_load_py_test"
${BUILD_CMD}
@@ -431,8 +435,8 @@ do_check_load_py_test() {
}
# Supply all sanity step commands and descriptions
-SANITY_STEPS=("do_pylint PYTHON2" "do_pylint PYTHON3" "do_buildifier" "do_bazel_nobuild" "do_pip_package_licenses_check" "do_lib_package_licenses_check" "do_java_package_licenses_check" "do_pip_smoke_test" "do_check_load_py_test")
-SANITY_STEPS_DESC=("Python 2 pylint" "Python 3 pylint" "buildifier check" "bazel nobuild" "pip: license check for external dependencies" "C library: license check for external dependencies" "Java Native Library: license check for external dependencies" "Pip Smoke Test: Checking py_test dependencies exist in pip package" "Check load py_test: Check that BUILD files with py_test target properly load py_test")
+SANITY_STEPS=("do_pylint PYTHON2" "do_pylint PYTHON3" "do_buildifier" "do_bazel_nobuild" "do_pip_package_licenses_check" "do_lib_package_licenses_check" "do_java_package_licenses_check" "do_pip_smoke_test" "do_check_load_py_test" "do_code_link_check")
+SANITY_STEPS_DESC=("Python 2 pylint" "Python 3 pylint" "buildifier check" "bazel nobuild" "pip: license check for external dependencies" "C library: license check for external dependencies" "Java Native Library: license check for external dependencies" "Pip Smoke Test: Checking py_test dependencies exist in pip package" "Check load py_test: Check that BUILD files with py_test target properly load py_test" "Code Link Check: Check there are no broken links")
INCREMENTAL_FLAG=""
diff --git a/tensorflow/tools/ci_build/code_link_check.sh b/tensorflow/tools/ci_build/code_link_check.sh
new file mode 100755
index 0000000000..09130482cc
--- /dev/null
+++ b/tensorflow/tools/ci_build/code_link_check.sh
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ==============================================================================
+
+# please run this at root directory of tensorflow
+success=1
+
+for i in `grep -onI https://www.tensorflow.org/code/\[a-zA-Z0-9/._-\]\* -r tensorflow`
+do
+ filename=`echo $i|awk -F: '{print $1}'`
+ linenumber=`echo $i|awk -F: '{print $2}'`
+ target=`echo $i|awk -F: '{print $4}'|tail -c +27`
+
+ # skip files in tensorflow/models
+ if [[ $target == tensorflow_models/* ]] ; then
+ continue
+ fi
+
+ if [ ! -f $target ] && [ ! -d $target ]; then
+ success=0
+ echo Broken link $target at line $linenumber of file $filename
+ fi
+done
+
+if [ $success == 0 ]; then
+ echo Code link check fails.
+ exit 1
+fi
+
+echo Code link check success.
diff --git a/tensorflow/tools/ci_build/install/install_golang.sh b/tensorflow/tools/ci_build/install/install_golang.sh
index fef203b869..88bc2960e3 100755
--- a/tensorflow/tools/ci_build/install/install_golang.sh
+++ b/tensorflow/tools/ci_build/install/install_golang.sh
@@ -16,7 +16,7 @@
set -ex
-GOLANG_URL="https://storage.googleapis.com/golang/go1.7.5.linux-amd64.tar.gz"
+GOLANG_URL="https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz"
sudo mkdir -p /usr/local
wget -q -O - "${GOLANG_URL}" | sudo tar -C /usr/local -xz
diff --git a/tensorflow/tools/ci_build/windows/gpu/pip/build_tf_windows.sh b/tensorflow/tools/ci_build/windows/gpu/pip/build_tf_windows.sh
index cc157c33f5..7cb81c20f0 100644
--- a/tensorflow/tools/ci_build/windows/gpu/pip/build_tf_windows.sh
+++ b/tensorflow/tools/ci_build/windows/gpu/pip/build_tf_windows.sh
@@ -60,7 +60,7 @@ reinstall_tensorflow_pip ${PIP_NAME}
# Define no_tensorflow_py_deps=true so that every py_test has no deps anymore,
# which will result testing system installed tensorflow
-# GPU tests are very flaky when running concurently, so set local_test_jobs=1
+# GPU tests are very flaky when running concurrently, so set local_test_jobs=1
bazel test -c opt --config=win-cuda $BUILD_OPTS -k --test_output=errors \
--define=no_tensorflow_py_deps=true --test_lang_filters=py \
--test_tag_filters=-no_pip,-no_windows,-no_windows_gpu \
diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl
index a5f0440601..4760673058 100644
--- a/tensorflow/workspace.bzl
+++ b/tensorflow/workspace.bzl
@@ -205,11 +205,11 @@ def tf_workspace(path_prefix="", tf_repo_name=""):
native.new_http_archive(
name = "farmhash_archive",
urls = [
- "http://mirror.bazel.build/github.com/google/farmhash/archive/92e897b282426729f4724d91a637596c7e2fe28f.zip",
- "https://github.com/google/farmhash/archive/92e897b282426729f4724d91a637596c7e2fe28f.zip",
+ "http://mirror.bazel.build/github.com/google/farmhash/archive/23eecfbe7e84ebf2e229bd02248f431c36e12f1a.zip",
+ "https://github.com/google/farmhash/archive/23eecfbe7e84ebf2e229bd02248f431c36e12f1a.zip",
],
- sha256 = "4c626d1f306bda2c6804ab955892f803f5245f4dcaecb4979dc08b091256da54",
- strip_prefix = "farmhash-92e897b282426729f4724d91a637596c7e2fe28f",
+ sha256 = "55215f8cd3ddbe9781f6fe5cc228731d6dcc8301b6191c6d420034c3fff1cb8d",
+ strip_prefix = "farmhash-23eecfbe7e84ebf2e229bd02248f431c36e12f1a",
build_file = str(Label("//third_party:farmhash.BUILD")),
)
diff --git a/tools/bazel.rc b/tools/bazel.rc
index e67a290cf4..414ddf2e47 100644
--- a/tools/bazel.rc
+++ b/tools/bazel.rc
@@ -11,6 +11,9 @@ build:mkl --define=using_mkl=true
build:sycl --crosstool_top=@local_config_sycl//crosstool:toolchain
build:sycl --define=using_sycl=true
+build:sycl_nodouble --crosstool_top=@local_config_sycl//crosstool:toolchain
+build:sycl_nodouble --define=using_sycl=true --cxxopt -DTENSORFLOW_SYCL_NO_DOUBLE
+
build:sycl_asan --crosstool_top=@local_config_sycl//crosstool:toolchain
build:sycl_asan --define=using_sycl=true --copt -fno-omit-frame-pointer --copt -fsanitize-coverage=3 --copt -DGPR_NO_DIRECT_SYSCALLS --linkopt -fPIC --linkopt -fsanitize=address