Skip to content

Commit

Permalink
Merge changes from github.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 167401527
  • Loading branch information
martinwicke authored and tensorflower-gardener committed Sep 3, 2017
1 parent ddba1e0 commit d57572e
Show file tree
Hide file tree
Showing 33 changed files with 134 additions and 84 deletions.
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -36,7 +36,15 @@ and discussion, and please direct specific questions to [Stack Overflow](https:/

People who are a little more adventurous can also try our nightly binaries:

**Nightly pip packages**
* We are pleased to announce that TensorFlow now offers nightly pip packages
under the [tf-nightly](https://pypi.python.org/pypi/tf-nightly) project on pypi.
Simply run `pip install tf-nightly` in a clean environment to install the nightly
tensorflow build. We currently only support CPU-only packages on Linux and Mac.
GPU packages on all platforms and Windows CPU-only packages will arrive soon!


**Individual whl files**
* Linux CPU-only: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-1.3.0-cp27-none-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=cpu-slave)) / [Python 3.4](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-1.3.0-cp34-cp34m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=cpu-slave/)) / [Python 3.5](https://ci.tensorflow.org/view/Nightly/job/nightly-python35-linux-cpu/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-1.3.0-cp35-cp35m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-python35-linux-cpu/))
* Linux GPU: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow_gpu-1.3.0-cp27-none-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-linux/)) / [Python 3.4](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow_gpu-1.3.0-cp34-cp34m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=gpu-linux/)) / [Python 3.5](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3.5,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow_gpu-1.3.0-cp35-cp35m-linux_x86_64.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3.5,label=gpu-linux/))
* Mac CPU-only: [Python 2](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=mac-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-1.3.0-py2-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=mac-slave/)) / [Python 3](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=mac-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-1.3.0-py3-none-any.whl) ([build history](https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=mac-slave/))
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Expand Up @@ -46,7 +46,7 @@ See also [TensorBoard 0.1.4](https://github.com/tensorflow/tensorboard/releases/
* Display feed values with the `print_feed` or `pf` command and clickable links in the curses UI.
* Runtime profiler at the op level and the Python source line level with the `run -p` command.
* Initial release of the statistical distribution library `tf.distributions`.
* GPU kernels and speed improvements for for unary `tf.where` and `tf.nn.top_k`.
* GPU kernels and speed improvements for unary `tf.where` and `tf.nn.top_k`.
* Monotonic Attention wrappers added to `tf.contrib.seq2seq`.
* Added `tf.contrib.signal`, a library for signal processing primitives.
* Added `tf.contrib.resampler`, containing CPU and GPU ops for differentiable resampling of images.
Expand Down
8 changes: 4 additions & 4 deletions WORKSPACE
Expand Up @@ -2,11 +2,11 @@ workspace(name = "org_tensorflow")

http_archive(
name = "io_bazel_rules_closure",
sha256 = "bc41b80486413aaa551860fc37471dbc0666e1dbb5236fb6177cb83b0c105846",
strip_prefix = "rules_closure-dec425a4ff3faf09a56c85d082e4eed05d8ce38f",
sha256 = "25f5399f18d8bf9ce435f85c6bbf671ec4820bc4396b3022cc5dc4bc66303609",
strip_prefix = "rules_closure-0.4.2",
urls = [
"http://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/dec425a4ff3faf09a56c85d082e4eed05d8ce38f.tar.gz", # 2017-06-02
"https://github.com/bazelbuild/rules_closure/archive/dec425a4ff3faf09a56c85d082e4eed05d8ce38f.tar.gz",
"http://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/0.4.2.tar.gz", # 2017-08-29
"https://github.com/bazelbuild/rules_closure/archive/0.4.2.tar.gz",
],
)

Expand Down
10 changes: 5 additions & 5 deletions configure.py
Expand Up @@ -143,7 +143,7 @@ def run_shell(cmd, allow_non_zero=False):

def cygpath(path):
"""Convert path from posix to windows."""
return run_shell(['cygpath', '-m', path])
return os.path.abspath(path).replace('\\', '/')


def get_python_path(environ_cp, python_bin_path):
Expand Down Expand Up @@ -196,7 +196,7 @@ def setup_python(environ_cp, bazel_version):
environ_cp['PYTHON_BIN_PATH'] = ''

# Convert python path to Windows style before checking lib and version
if is_cygwin():
if is_windows() or is_cygwin():
python_bin_path = cygpath(python_bin_path)

# Get PYTHON_LIB_PATH
Expand All @@ -219,7 +219,7 @@ def setup_python(environ_cp, bazel_version):
python_major_version = get_python_major_version(python_bin_path)

# Convert python path to Windows style before writing into bazel.rc
if is_cygwin():
if is_windows() or is_cygwin():
python_lib_path = cygpath(python_lib_path)

# Set-up env variables used by python_configure.bzl
Expand Down Expand Up @@ -600,7 +600,7 @@ def set_tf_cuda_version(environ_cp):

# Find out where the CUDA toolkit is installed
default_cuda_path = _DEFAULT_CUDA_PATH
if is_cygwin():
if is_windows() or is_cygwin():
default_cuda_path = cygpath(
environ_cp.get('CUDA_PATH', _DEFAULT_CUDA_PATH_WIN))
elif is_linux():
Expand Down Expand Up @@ -660,7 +660,7 @@ def set_tf_cunn_version(environ_cp):
# unusable. Going through one more level of expansion to handle that.
cudnn_install_path = os.path.realpath(
os.path.expanduser(cudnn_install_path))
if is_cygwin():
if is_windows() or is_cygwin():
cudnn_install_path = cygpath(cudnn_install_path)

if is_windows():
Expand Down
8 changes: 8 additions & 0 deletions tensorflow/cc/gradients/nn_grad.cc
Expand Up @@ -95,6 +95,14 @@ Status SeluGradHelper(const Scope& scope, const Operation& op,
}
REGISTER_GRADIENT_OP("Selu", SeluGradHelper);

Status L2LossGrad(const Scope& scope, const Operation& op,
const std::vector<Output>& grad_inputs,
std::vector<Output>* grad_outputs) {
grad_outputs->push_back(Mul(scope, op.input(0), grad_inputs[0]));
return scope.status();
}
REGISTER_GRADIENT_OP("L2Loss", L2LossGrad);

Status BiasAddGradHelper(const Scope& scope, const Operation& op,
const std::vector<Output>& grad_inputs,
std::vector<Output>* grad_outputs) {
Expand Down
8 changes: 8 additions & 0 deletions tensorflow/cc/gradients/nn_grad_test.cc
Expand Up @@ -122,6 +122,14 @@ TEST_F(NNGradTest, SeluGrad) {
RunTest(x, x_init_value, y, shape);
}

TEST_F(NNGradTest, L2LossGrad) {
TensorShape x_shape({5, 2});
TensorShape y_shape({1});
auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(x_shape));
auto y = L2Loss(scope_, x);
RunTest(x, x_shape, y, y_shape);
}

TEST_F(NNGradTest, BiasAddGradHelper) {
TensorShape shape({4, 5});
TensorShape bias_shape({5});
Expand Down
Expand Up @@ -389,7 +389,7 @@ StatusOr<string> CompileModuleToPtx(llvm::Module* module,

// Loop unrolling exposes more opportunities for SROA. Therefore, we run SROA
// again after the standard optimization passes [http://b/13329423].
// TODO(jingyue): SROA may further expose more optimization opportunities, such
// TODO(jingyue): SROA may further expose more optimization opportunities such
// as more precise alias analysis and more function inlining (SROA may change
// the inlining cost of a function). For now, running SROA already emits good
// enough code for the evaluated benchmarks. We may want to run more
Expand Down
2 changes: 2 additions & 0 deletions tensorflow/contrib/cmake/tf_tests.cmake
Expand Up @@ -82,6 +82,7 @@ function(AddTest)
set_tests_properties(${_AT_TARGET}
PROPERTIES ENVIRONMENT "TEST_TMPDIR=${tempdir};TEST_SRCDIR=${testdir}"
)
set_tests_properties(${_AT_TARGET} PROPERTIES TIMEOUT "600")

foreach(datafile ${_AT_DATA})
file(RELATIVE_PATH datafile_rel ${tensorflow_source_dir} ${datafile})
Expand Down Expand Up @@ -117,6 +118,7 @@ function(AddPythonTests)
if (_AT_DEPENDS)
add_dependencies(${_AT_TARGET} ${_AT_DEPENDS})
endif()
set_tests_properties(${sourcefile} PROPERTIES TIMEOUT "600")
endforeach()
endfunction(AddPythonTests)

Expand Down
1 change: 1 addition & 0 deletions tensorflow/contrib/gdr/BUILD
Expand Up @@ -62,6 +62,7 @@ tf_cuda_library(
}),
deps = [
":gdr_proto_cc",
"//tensorflow/core:core_cpu_internal",
"//tensorflow/core:framework",
"//tensorflow/core:gpu_runtime",
"//tensorflow/core:lib",
Expand Down
7 changes: 1 addition & 6 deletions tensorflow/contrib/gdr/gdr_memory_manager.h
Expand Up @@ -16,14 +16,9 @@ limitations under the License.
#ifndef GDR_MEMORY_MANAGER_H_
#define GDR_MEMORY_MANAGER_H_

#include "google/protobuf/any.pb.h"
#include "tensorflow/core/lib/core/status.h"

namespace google {
namespace protobuf {
class Any;
}
}

namespace tensorflow {

class Device;
Expand Down
1 change: 1 addition & 0 deletions tensorflow/contrib/layers/__init__.py
Expand Up @@ -115,6 +115,7 @@
'legacy_linear',
'legacy_relu',
'OPTIMIZER_CLS_NAMES',
'OPTIMIZER_SUMMARIES',
'regression_target',
'SPARSE_FEATURE_CROSS_DEFAULT_HASH_KEY',
'summaries']
Expand Down
5 changes: 3 additions & 2 deletions tensorflow/contrib/layers/python/layers/optimizers.py
Expand Up @@ -129,8 +129,9 @@ class should be sub-class of `tf.Optimizer` that implements
`None` to use all trainable variables.
name: The name for this operation is used to scope operations and summaries.
summaries: List of internal quantities to visualize on tensorboard. If not
set only the loss and the learning rate will be reported. The
complete list is in OPTIMIZER_SUMMARIES.
set, the loss, the learning rate, and the global norm of the
gradients will be reported. The complete list of possible values
is in OPTIMIZER_SUMMARIES.
colocate_gradients_with_ops: If True, try colocating gradients with the
corresponding op.
increment_global_step: Whether to increment `global_step`. If your model
Expand Down
26 changes: 15 additions & 11 deletions tensorflow/contrib/learn/python/learn/learn_io/data_feeder.py
Expand Up @@ -28,7 +28,6 @@
from six.moves import xrange # pylint: disable=redefined-builtin

from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.platform import tf_logging as logging

Expand All @@ -44,7 +43,7 @@ def _get_in_out_shape(x_shape, y_shape, n_classes, batch_size=None):
x_is_dict, y_is_dict = isinstance(
x_shape, dict), y_shape is not None and isinstance(y_shape, dict)
if y_is_dict and n_classes is not None:
assert (isinstance(n_classes, dict))
assert isinstance(n_classes, dict)

if batch_size is None:
batch_size = list(x_shape.values())[0][0] if x_is_dict else x_shape[0]
Expand Down Expand Up @@ -322,10 +321,12 @@ def __init__(self,

self._x = dict([(k, check_array(v, v.dtype)) for k, v in list(x.items())
]) if x_is_dict else check_array(x, x.dtype)
self._y = None if y is None else \
dict([(k, check_array(v, v.dtype)) for k, v in list(y.items())]) if x_is_dict else check_array(y, y.dtype)
self._y = None if y is None else (
dict([(k, check_array(v, v.dtype)) for k, v in list(y.items())])
if y_is_dict else check_array(y, y.dtype))

# self.n_classes is not None means we're converting raw target indices to one-hot.
# self.n_classes is not None means we're converting raw target indices
# to one-hot.
if n_classes is not None:
if not y_is_dict:
y_dtype = (np.int64
Expand All @@ -344,12 +345,15 @@ def __init__(self,
x_shape, y_shape, n_classes, batch_size)

# Input dtype matches dtype of x.
self._input_dtype = dict([(k, _check_dtype(v.dtype)) for k, v in list(self._x.items())]) if x_is_dict \
else _check_dtype(self._x.dtype)

# note: self._output_dtype = np.float32 when y is None
self._output_dtype = dict([(k, _check_dtype(v.dtype)) for k, v in list(self._y.items())]) if y_is_dict \
else _check_dtype(self._y.dtype) if y is not None else np.float32
self._input_dtype = (
dict([(k, _check_dtype(v.dtype)) for k, v in list(self._x.items())])
if x_is_dict else _check_dtype(self._x.dtype))

# self._output_dtype == np.float32 when y is None
self._output_dtype = (
dict([(k, _check_dtype(v.dtype)) for k, v in list(self._y.items())])
if y_is_dict else (
_check_dtype(self._y.dtype) if y is not None else np.float32))

# self.n_classes is None means we're passing in raw target indices
if n_classes is not None and y_is_dict:
Expand Down
12 changes: 6 additions & 6 deletions tensorflow/contrib/makefile/Makefile
Expand Up @@ -316,14 +316,14 @@ ifeq ($(TARGET),IOS)
IPHONESIMULATOR_SYSROOT := $(shell xcrun --sdk iphonesimulator \
--show-sdk-path)
IOS_SDK_VERSION := $(shell xcrun --sdk iphoneos --show-sdk-version)
MIN_SDK_VERSION := 8.0
MIN_SDK_VERSION := 9.0
# Override IOS_ARCH with ARMV7, ARMV7S, ARM64, or I386.
IOS_ARCH := X86_64
ifeq ($(IOS_ARCH),ARMV7)
CXXFLAGS += -miphoneos-version-min=$(MIN_SDK_VERSION) \
-arch armv7 \
-fembed-bitcode \
-D__thread= \
-D__thread=thread_local \
-DUSE_GEMM_FOR_CONV \
-Wno-c++11-narrowing \
-mno-thumb \
Expand All @@ -347,7 +347,7 @@ ifeq ($(TARGET),IOS)
CXXFLAGS += -miphoneos-version-min=$(MIN_SDK_VERSION) \
-arch armv7s \
-fembed-bitcode \
-D__thread= \
-D__thread=thread_local \
-DUSE_GEMM_FOR_CONV \
-Wno-c++11-narrowing \
-mno-thumb \
Expand All @@ -371,7 +371,7 @@ ifeq ($(TARGET),IOS)
CXXFLAGS += -miphoneos-version-min=$(MIN_SDK_VERSION) \
-arch arm64 \
-fembed-bitcode \
-D__thread= \
-D__thread=thread_local \
-DUSE_GEMM_FOR_CONV \
-Wno-c++11-narrowing \
-DTF_LEAN_BINARY \
Expand All @@ -395,7 +395,7 @@ ifeq ($(TARGET),IOS)
-arch i386 \
-mno-sse \
-fembed-bitcode \
-D__thread= \
-D__thread=thread_local \
-DUSE_GEMM_FOR_CONV \
-Wno-c++11-narrowing \
-DTF_LEAN_BINARY \
Expand All @@ -418,7 +418,7 @@ ifeq ($(TARGET),IOS)
CXXFLAGS += -mios-simulator-version-min=$(MIN_SDK_VERSION) \
-arch x86_64 \
-fembed-bitcode \
-D__thread= \
-D__thread=thread_local \
-DUSE_GEMM_FOR_CONV \
-Wno-c++11-narrowing \
-DTF_LEAN_BINARY \
Expand Down
3 changes: 2 additions & 1 deletion tensorflow/contrib/makefile/README.md
Expand Up @@ -201,7 +201,8 @@ tensorflow/contrib/makefile/compile_ios_protobuf.sh

Then, you will need to compile the nsync library for iOS:

```export HOST_NSYNC_LIB=`tensorflow/contrib/makefile/compile_nsync.sh`
```bash
export HOST_NSYNC_LIB=`tensorflow/contrib/makefile/compile_nsync.sh`
export TARGET_NSYNC_LIB=`tensorflow/contrib/makefile/compile_nsync.sh -t ios`
```

Expand Down
27 changes: 15 additions & 12 deletions tensorflow/core/distributed_runtime/base_rendezvous_mgr.cc
Expand Up @@ -35,14 +35,18 @@ limitations under the License.

namespace tensorflow {

static void StartAbortRendevous(Rendezvous* rendez, const Status& s) {
rendez->StartAbort(s);
rendez->Unref();
}

BaseRendezvousMgr::BaseRendezvousMgr(const WorkerEnv* worker_env)
: worker_env_(worker_env) {}

BaseRendezvousMgr::~BaseRendezvousMgr() {
for (auto& p : table_) {
BaseRemoteRendezvous* rendez = p.second;
rendez->StartAbort(errors::Aborted("Shutdown"));
rendez->Unref();
auto rendez = p.second;
StartAbortRendevous(rendez, errors::Aborted("Shutdown"));
}
}

Expand All @@ -52,7 +56,7 @@ RemoteRendezvous* BaseRendezvousMgr::Find(int64 step_id) {

BaseRemoteRendezvous* BaseRendezvousMgr::FindOrCreate(int64 step_id) {
mutex_lock l(mu_);
Table::iterator iter = table_.find(step_id);
auto iter = table_.find(step_id);
if (iter == table_.end()) {
auto rr = Create(step_id, worker_env_);
iter = table_.insert({step_id, rr}).first;
Expand All @@ -64,7 +68,7 @@ BaseRemoteRendezvous* BaseRendezvousMgr::FindOrCreate(int64 step_id) {
void BaseRendezvousMgr::RecvLocalAsync(int64 step_id,
const Rendezvous::ParsedKey& parsed,
Rendezvous::DoneCallback done) {
BaseRemoteRendezvous* rendez = FindOrCreate(step_id);
auto rendez = FindOrCreate(step_id);
using namespace std::placeholders;
Rendezvous::DoneCallback done_cb = std::bind(
[rendez](Rendezvous::DoneCallback done,
Expand Down Expand Up @@ -101,15 +105,15 @@ void BaseRendezvousMgr::Cleanup(int64 step_id) {
Rendezvous* rendez = nullptr;
{
mutex_lock l(mu_);
Table::iterator iter = table_.find(step_id);
auto iter = table_.find(step_id);
if (iter != table_.end()) {
rendez = iter->second;
table_.erase(iter);
}
}
if (!rendez) return;
rendez->StartAbort(errors::Aborted("Cleanup ", step_id));
rendez->Unref();
if (rendez) {
StartAbortRendevous(rendez, errors::Aborted("Cleanup ", step_id));
}
}

void BaseRendezvousMgr::CleanupAll() {
Expand All @@ -122,8 +126,7 @@ void BaseRendezvousMgr::CleanupAll() {
table_.clear();
}
for (auto rendez : rendezs) {
rendez->StartAbort(errors::Aborted("Shutdown"));
rendez->Unref();
StartAbortRendevous(rendez, errors::Aborted("Shutdown"));
}
}

Expand Down Expand Up @@ -165,7 +168,7 @@ Status BaseRemoteRendezvous::Initialize(WorkerSession* session) {
session_ = session;
std::swap(deferred_calls, deferred_calls_);
}
for (DeferredCall& call : deferred_calls) {
for (auto& call : deferred_calls) {
RecvLocalAsyncInternal(call.parsed, std::move(call.done));
}
return Status::OK();
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/core/framework/op_kernel.h
Expand Up @@ -310,7 +310,7 @@ class OpKernelConstruction {
FunctionLibraryRuntime* function_library() const { return flib_; }

// The GraphDef version whose behavior we should follow.
const int graph_def_version() const { return graph_def_version_; }
int graph_def_version() const { return graph_def_version_; }

// Helper routines for the OP_REQUIRES macros
void CtxFailure(Status s);
Expand Down

0 comments on commit d57572e

Please sign in to comment.