aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Vijay Vasudevan <vrv@google.com>2016-01-24 23:05:22 -0800
committerGravatar Vijay Vasudevan <vrv@google.com>2016-01-24 23:06:20 -0800
commit9b70316263eb74476ab96b7c0f300c4d90223425 (patch)
treed10e30463edbc10e5225b80a90579abb00da87cf
parent87af568b0b3e920d91cdb2114fd3f40d8b9504a9 (diff)
Running our linter on a lot of files.
Change: 112920860
-rw-r--r--WORKSPACE4
-rwxr-xr-xconfigure2
-rw-r--r--eigen.BUILD2
-rw-r--r--tensorflow/cc/ops/cc_op_gen.cc2
-rw-r--r--tensorflow/core/common_runtime/direct_session.cc4
-rw-r--r--tensorflow/core/common_runtime/direct_session_test.cc2
-rw-r--r--tensorflow/core/common_runtime/executor.cc2
-rw-r--r--tensorflow/core/common_runtime/function.cc4
-rw-r--r--tensorflow/core/common_runtime/function.h2
-rw-r--r--tensorflow/core/common_runtime/gpu/gpu_allocator_retry.h2
-rw-r--r--tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc2
-rw-r--r--tensorflow/core/common_runtime/gpu/gpu_event_mgr_test.cc2
-rw-r--r--tensorflow/core/common_runtime/gpu/gpu_region_allocator.cc2
-rw-r--r--tensorflow/core/common_runtime/gpu/gpu_stream_util.cc2
-rw-r--r--tensorflow/core/common_runtime/gpu/gpu_util.h2
-rw-r--r--tensorflow/core/common_runtime/gpu/pool_allocator.cc4
-rw-r--r--tensorflow/core/common_runtime/gpu/process_state.cc2
-rw-r--r--tensorflow/core/common_runtime/gpu/process_state.h6
-rw-r--r--tensorflow/core/common_runtime/kernel_benchmark_testlib.h2
-rw-r--r--tensorflow/core/common_runtime/local_device.h2
-rw-r--r--tensorflow/core/common_runtime/session_factory.h2
-rw-r--r--tensorflow/core/common_runtime/simple_placer.cc2
-rw-r--r--tensorflow/core/framework/attr_value_util.h2
-rw-r--r--tensorflow/core/framework/function.proto2
-rw-r--r--tensorflow/core/framework/function_test.cc4
-rw-r--r--tensorflow/core/framework/node_def_util.h2
-rw-r--r--tensorflow/core/framework/op.h2
-rw-r--r--tensorflow/core/framework/op_compatibility_test.cc6
-rw-r--r--tensorflow/core/framework/op_def_builder.h2
-rw-r--r--tensorflow/core/framework/op_kernel.h2
-rw-r--r--tensorflow/core/framework/reader_interface.h2
-rw-r--r--tensorflow/core/framework/rendezvous.h2
-rw-r--r--tensorflow/core/framework/tensor.proto4
-rw-r--r--tensorflow/core/framework/tensor_slice.h2
-rw-r--r--tensorflow/core/framework/tensor_testutil.h2
-rw-r--r--tensorflow/core/kernels/adjust_contrast_op.h9
-rw-r--r--tensorflow/core/kernels/check_numerics_op.cc1
-rw-r--r--tensorflow/core/kernels/serialize_sparse_op.cc1
-rw-r--r--tensorflow/core/kernels/sparse_concat_op.cc1
-rw-r--r--tensorflow/core/kernels/sparse_reorder_op.cc1
-rw-r--r--tensorflow/core/kernels/sparse_to_dense_op.cc1
-rw-r--r--tensorflow/core/ops/functional_ops.cc2
-rw-r--r--tensorflow/core/ops/io_ops.cc2
-rw-r--r--tensorflow/core/ops/math_grad.cc2
-rw-r--r--tensorflow/core/ops/nn_ops.cc2
-rw-r--r--tensorflow/core/ops/ops.pbtxt10
-rw-r--r--tensorflow/core/ops/parsing_ops.cc2
-rw-r--r--tensorflow/core/platform/tracing.h2
-rw-r--r--tensorflow/core/public/tensor_c_api.h2
-rw-r--r--tensorflow/core/util/sparse/sparse_tensor.h2
-rw-r--r--tensorflow/core/util/tensor_slice_set.cc6
-rw-r--r--tensorflow/core/util/tensor_slice_set.h2
-rw-r--r--tensorflow/core/util/use_cudnn.h2
-rw-r--r--tensorflow/examples/tutorials/mnist/fully_connected_feed.py2
-rw-r--r--tensorflow/examples/tutorials/mnist/mnist.py2
-rw-r--r--tensorflow/examples/tutorials/mnist/mnist_softmax.py2
-rw-r--r--tensorflow/examples/tutorials/mnist/mnist_with_summaries.py8
-rw-r--r--tensorflow/examples/tutorials/word2vec/word2vec_basic.py14
-rw-r--r--tensorflow/examples/udacity/1_notmnist.ipynb4
-rw-r--r--tensorflow/examples/udacity/4_convolutions.ipynb4
-rw-r--r--tensorflow/g3doc/api_docs/index.md2
-rw-r--r--tensorflow/g3doc/api_docs/python/framework.md2
-rw-r--r--tensorflow/g3doc/api_docs/python/nn.md4
-rw-r--r--tensorflow/g3doc/get_started/os_setup.md59
-rw-r--r--tensorflow/g3doc/how_tos/reading_data/index.md2
-rw-r--r--tensorflow/g3doc/how_tos/threading_and_queues/index.md2
-rw-r--r--tensorflow/g3doc/resources/dims_types.md4
-rw-r--r--tensorflow/g3doc/tutorials/mnist/tf/index.md2
-rw-r--r--tensorflow/g3doc/tutorials/recurrent/index.md6
-rw-r--r--tensorflow/g3doc/tutorials/seq2seq/index.md4
-rw-r--r--tensorflow/models/embedding/word2vec_kernels.cc2
-rw-r--r--tensorflow/models/embedding/word2vec_ops.cc2
-rw-r--r--tensorflow/models/image/alexnet/alexnet_benchmark.py2
-rw-r--r--tensorflow/models/image/cifar10/cifar10.py10
-rw-r--r--tensorflow/models/image/cifar10/cifar10_multi_gpu_train.py2
-rw-r--r--tensorflow/models/rnn/ptb/ptb_word_lm.py6
-rw-r--r--tensorflow/models/rnn/ptb/reader.py3
-rw-r--r--tensorflow/models/rnn/translate/data_utils.py2
-rw-r--r--tensorflow/models/rnn/translate/seq2seq_model.py9
-rw-r--r--tensorflow/python/client/session.py19
-rw-r--r--tensorflow/python/client/session_test.py138
-rw-r--r--tensorflow/python/client/tf_session.i4
-rw-r--r--tensorflow/python/framework/docs.py2
-rw-r--r--tensorflow/python/framework/ops.py6
-rw-r--r--tensorflow/python/kernel_tests/control_flow_ops_py_test.py41
-rw-r--r--tensorflow/python/kernel_tests/cwise_ops_test.py2
-rw-r--r--tensorflow/python/kernel_tests/rnn_test.py95
-rw-r--r--tensorflow/python/lib/core/py_func.cc10
-rw-r--r--tensorflow/python/ops/candidate_sampling_ops.py17
-rw-r--r--tensorflow/python/ops/control_flow_ops.py25
-rw-r--r--tensorflow/python/ops/math_ops.py14
-rw-r--r--tensorflow/python/ops/nn.py6
-rw-r--r--tensorflow/python/ops/rnn.py12
-rw-r--r--tensorflow/python/ops/rnn_cell.py12
-rw-r--r--tensorflow/python/summary/impl/reservoir.py2
-rw-r--r--tensorflow/python/training/adagrad.py2
-rw-r--r--tensorflow/python/training/adam.py2
-rw-r--r--tensorflow/python/training/coordinator.py6
-rw-r--r--tensorflow/python/training/ftrl.py2
-rw-r--r--tensorflow/python/training/ftrl_test.py2
-rw-r--r--tensorflow/python/training/learning_rate_decay.py2
-rw-r--r--tensorflow/python/training/momentum_test.py2
-rw-r--r--tensorflow/python/training/moving_averages.py2
-rw-r--r--tensorflow/python/training/optimizer.py15
-rw-r--r--tensorflow/python/training/rmsprop.py10
-rw-r--r--tensorflow/python/training/saver.py118
-rw-r--r--tensorflow/python/training/saver_test.py131
-rw-r--r--tensorflow/python/training/summary_io.py6
-rw-r--r--tensorflow/python/training/summary_writer_test.py2
-rw-r--r--tensorflow/python/training/training.py5
-rw-r--r--tensorflow/tensorboard/components/tf-categorizer/demo/index.html1
-rw-r--r--tensorflow/tensorboard/components/tf-event-dashboard/tf-chart.html2
-rw-r--r--tensorflow/tensorboard/components/tf-event-dashboard/tf-chart.ts3
-rw-r--r--tensorflow/tensorboard/components/tf-graph-common/lib/colors.ts249
-rw-r--r--tensorflow/tensorboard/components/tf-graph-common/lib/common.ts2
-rw-r--r--tensorflow/tensorboard/components/tf-graph-common/lib/graph.ts6
-rw-r--r--tensorflow/tensorboard/components/tf-graph-common/lib/hierarchy.ts6
-rw-r--r--tensorflow/tensorboard/components/tf-graph-common/lib/layout.ts2
-rw-r--r--tensorflow/tensorboard/components/tf-graph-common/lib/render.ts2
-rw-r--r--tensorflow/tensorboard/components/tf-graph-dashboard/tf-graph-dashboard.html1
-rw-r--r--tensorflow/tensorboard/components/tf-graph/tf-graph.html2
-rw-r--r--tensorflow/tensorboard/components/tf-image-dashboard/tf-image-grid.html4
-rw-r--r--tensorflow/tensorboard/components/tf-image-dashboard/tf-image-loader.html4
-rw-r--r--tensorflow/tensorboard/components/tf-imports/dagre.html2
-rw-r--r--tensorflow/tensorboard/components/tf-imports/google/README.md2
-rw-r--r--tensorflow/tensorboard/components/tf-multi-checkbox/tf-multi-checkbox.html4
-rw-r--r--tensorflow/tensorboard/components/tf-tensorboard/demo/index.html2
-rw-r--r--tensorflow/tensorboard/dist/tf-tensorboard.html6
-rw-r--r--tensorflow/tensorboard/gulpfile.js24
-rw-r--r--tensorflow/tensorboard/tensorboard.py11
-rw-r--r--tensorflow/tensorboard/tensorboard_handler.py21
-rw-r--r--tensorflow/tools/ci_build/Dockerfile.android3
-rw-r--r--tensorflow/tools/ci_build/Dockerfile.cpu1
-rw-r--r--tensorflow/tools/ci_build/Dockerfile.gpu1
-rwxr-xr-xtensorflow/tools/ci_build/builds/configured6
-rwxr-xr-xtensorflow/tools/ci_build/builds/with_the_same_user12
-rwxr-xr-xtensorflow/tools/ci_build/ci_build.sh6
-rwxr-xr-xtensorflow/tools/ci_build/install/install_bazel.sh2
-rwxr-xr-xtensorflow/tools/ci_build/install/install_deb_packages.sh3
-rw-r--r--tensorflow/tools/docker/Dockerfile.devel2
-rw-r--r--tensorflow/tools/docker/Dockerfile.devel-gpu2
-rw-r--r--third_party/eigen3/Eigen/Cholesky2
-rw-r--r--third_party/eigen3/Eigen/Core2
-rw-r--r--third_party/eigen3/Eigen/Eigenvalues2
-rw-r--r--third_party/eigen3/Eigen/LU2
-rw-r--r--third_party/eigen3/unsupported/Eigen/CXX11/Tensor2
-rw-r--r--third_party/gpus/crosstool/CROSSTOOL1
-rw-r--r--tools/bazel.rc.template4
148 files changed, 948 insertions, 474 deletions
diff --git a/WORKSPACE b/WORKSPACE
index c26bb521cb..a7f9116b68 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -21,8 +21,8 @@ new_http_archive(
new_http_archive(
name = "eigen_archive",
- url = "https://bitbucket.org/eigen/eigen/get/fb2fa05.tar.gz",
- sha256 = "8aacd8065d52528af1a22d6b72925dbb6b9fb8f25e46769481dd06d3edf63bbd",
+ url = "https://bitbucket.org/eigen/eigen/get/c8e5d09.tar.gz",
+ sha256 = "be61d1ce686e950d9a3a61b2aa83562ba4582ce1813e475869146e0a05915857",
build_file = "eigen.BUILD",
)
diff --git a/configure b/configure
index b64d4693bb..da5fb25f8f 100755
--- a/configure
+++ b/configure
@@ -92,7 +92,7 @@ while true; do
done
cat > third_party/gpus/cuda/cuda.config <<EOF
-# CUDA_TOOLKIT_PATH refers to the CUDA toolkit. Tensorflow requries Cuda 7.0
+# CUDA_TOOLKIT_PATH refers to the CUDA toolkit. Tensorflow requires Cuda 7.0
# at the moment.
CUDA_TOOLKIT_PATH="$CUDA_TOOLKIT_PATH"
diff --git a/eigen.BUILD b/eigen.BUILD
index 63fed34055..eefbed57f0 100644
--- a/eigen.BUILD
+++ b/eigen.BUILD
@@ -1,6 +1,6 @@
package(default_visibility = ["//visibility:public"])
-archive_dir = "eigen-eigen-fb2fa0527077"
+archive_dir = "eigen-eigen-c8e5d094f3a9"
cc_library(
name = "eigen",
diff --git a/tensorflow/cc/ops/cc_op_gen.cc b/tensorflow/cc/ops/cc_op_gen.cc
index 0d0da6c53c..351e5431e7 100644
--- a/tensorflow/cc/ops/cc_op_gen.cc
+++ b/tensorflow/cc/ops/cc_op_gen.cc
@@ -169,7 +169,7 @@ void WriteCCOp(const OpDef& op_def, WritableFile* h, WritableFile* cc) {
R"comment( .WithName(StringPiece): Set the Node's name
.WithDevice(StringPiece): Set the Node's requested device
.WithControlInput(Node*) / .WithControlInputs({Node*, ...}):
- Add control depencies on the specified Node(s).
+ Add control dependencies on the specified Node(s).
Returns a pointer to the created Node)comment");
diff --git a/tensorflow/core/common_runtime/direct_session.cc b/tensorflow/core/common_runtime/direct_session.cc
index 39230e3257..44ccdd8d7b 100644
--- a/tensorflow/core/common_runtime/direct_session.cc
+++ b/tensorflow/core/common_runtime/direct_session.cc
@@ -94,7 +94,7 @@ string GetRendezvousKey(const string& tensor_name,
//
// 2) Recv nodes always complete immediately: The inputs are sent into
// the local rendezvous before we start the executor, so the
-// corresonding recvs will not block.
+// corresponding recvs will not block.
//
// Based on these assumptions, we can use the same thread pool for
// both "non-blocking" and "blocking" OpKernels on Android.
@@ -543,7 +543,7 @@ Status DirectSession::CreateGraphs(
}
}
- for (auto partition : partitions) {
+ for (auto&& partition : partitions) {
const string& partition_name = partition.first;
GraphDef* graph_def = &partition.second;
diff --git a/tensorflow/core/common_runtime/direct_session_test.cc b/tensorflow/core/common_runtime/direct_session_test.cc
index b90b9fae38..5c80a4c135 100644
--- a/tensorflow/core/common_runtime/direct_session_test.cc
+++ b/tensorflow/core/common_runtime/direct_session_test.cc
@@ -95,7 +95,7 @@ TEST_F(DirectSessionMinusAXTest, RunSimpleNetwork) {
ASSERT_OK(s);
ASSERT_EQ(1, outputs.size());
- // The first output should be initiailzed and have the correct
+ // The first output should be initialized and have the correct
// output.
auto mat = outputs[0].matrix<float>();
ASSERT_TRUE(outputs[0].IsInitialized());
diff --git a/tensorflow/core/common_runtime/executor.cc b/tensorflow/core/common_runtime/executor.cc
index c6733b03bc..46eb0e027b 100644
--- a/tensorflow/core/common_runtime/executor.cc
+++ b/tensorflow/core/common_runtime/executor.cc
@@ -383,7 +383,7 @@ Status ExecutorImpl::InferAllocAttr(
return s;
}
-// The state associated with one invokation of ExecutorImpl::Run.
+// The state associated with one invocation of ExecutorImpl::Run.
// ExecutorState dispatches nodes when they become ready and keeps
// track of how many predecessors of a node have not done (pending_).
class ExecutorState {
diff --git a/tensorflow/core/common_runtime/function.cc b/tensorflow/core/common_runtime/function.cc
index d40130f65e..ffa605a18c 100644
--- a/tensorflow/core/common_runtime/function.cc
+++ b/tensorflow/core/common_runtime/function.cc
@@ -479,7 +479,7 @@ Status FunctionLibraryRuntimeImpl::InstantiateSymbolicGradient(
const auto& func = f->func();
const FunctionDef* fdef = lib_def_->Find(func.name());
if (fdef == nullptr) {
- // f is a primitve op.
+ // f is a primitive op.
gradient::Creator creator;
TF_RETURN_IF_ERROR(gradient::GetOpGradientCreator(func.name(), &creator));
if (creator == nullptr) {
@@ -1169,7 +1169,7 @@ class SymbolicGradientHelper {
// 'ready' keeps track of nodes that have been completely
// backpropped. Initially, for every output y of the function f, we
- // add dy as an input of the the gradient function.
+ // add dy as an input of the gradient function.
std::deque<Node*> ready_;
// Makes a copy of fbody_ in gbody_.
diff --git a/tensorflow/core/common_runtime/function.h b/tensorflow/core/common_runtime/function.h
index d7f52f8801..0655913e80 100644
--- a/tensorflow/core/common_runtime/function.h
+++ b/tensorflow/core/common_runtime/function.h
@@ -90,7 +90,7 @@ bool RemoveListArrayConverter(Graph* g);
// multiple times by calling ExpandInlineFunctions a few times.
bool ExpandInlineFunctions(FunctionLibraryRuntime* lib, Graph* graph);
-// Applies graph rewrite optimzation such as inlining, dead code
+// Applies graph rewrite optimization such as inlining, dead code
// removal, etc.
//
// **g is a graph constructed based on the runtime library 'lib'.
diff --git a/tensorflow/core/common_runtime/gpu/gpu_allocator_retry.h b/tensorflow/core/common_runtime/gpu/gpu_allocator_retry.h
index f0835f8931..8cee548527 100644
--- a/tensorflow/core/common_runtime/gpu/gpu_allocator_retry.h
+++ b/tensorflow/core/common_runtime/gpu/gpu_allocator_retry.h
@@ -32,7 +32,7 @@ class GPUAllocatorRetry {
// then wait up to 'max_millis_to_wait' milliseconds, retrying each
// time a call to DeallocateRaw() is detected, until either a good
// pointer is returned or the deadline is exhausted. If the
- // deadline is exahusted, try one more time with 'verbose_failure'
+ // deadline is exhausted, try one more time with 'verbose_failure'
// set to true. The value returned is either the first good pointer
// obtained from 'alloc_func' or nullptr.
void* AllocateRaw(std::function<void*(size_t alignment, size_t num_bytes,
diff --git a/tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc b/tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc
index 2ec149ee8e..6cc7b0f424 100644
--- a/tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc
+++ b/tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc
@@ -441,7 +441,7 @@ void GPUBFCAllocator::DumpMemoryLog(size_t num_bytes) {
}
}
- // Next show the the chunks that are in use, and also summarize their
+ // Next show the chunks that are in use, and also summarize their
// number by size.
std::map<size_t, int> in_use_by_size;
for (auto& it : ptr_to_chunk_map_) {
diff --git a/tensorflow/core/common_runtime/gpu/gpu_event_mgr_test.cc b/tensorflow/core/common_runtime/gpu/gpu_event_mgr_test.cc
index 004eb078b5..4917af43e6 100644
--- a/tensorflow/core/common_runtime/gpu/gpu_event_mgr_test.cc
+++ b/tensorflow/core/common_runtime/gpu/gpu_event_mgr_test.cc
@@ -198,7 +198,7 @@ TEST(EventMgr, StreamSwitchingFlushesImmediately) {
EXPECT_GT(initial_live_bytes, live_tensor_bytes);
}
-TEST(EventMgr, ManySmallTensorsSeperateCallsFlushed) {
+TEST(EventMgr, ManySmallTensorsSeparateCallsFlushed) {
auto stream_exec = GPUMachineManager()->ExecutorForDevice(0).ValueOrDie();
EventMgr em(stream_exec, GPUOptions());
TEST_EventMgrHelper th(&em);
diff --git a/tensorflow/core/common_runtime/gpu/gpu_region_allocator.cc b/tensorflow/core/common_runtime/gpu/gpu_region_allocator.cc
index 75a79cb438..ae85bae65b 100644
--- a/tensorflow/core/common_runtime/gpu/gpu_region_allocator.cc
+++ b/tensorflow/core/common_runtime/gpu/gpu_region_allocator.cc
@@ -280,7 +280,7 @@ void GPURegionAllocator::CheckForMemoryLeaks() {
}
// Since there's no merging of chunks once allocated, we want to
-// maximize their reusablity (which argues for fewer, larger sizes),
+// maximize their reusability (which argues for fewer, larger sizes),
// while minimizing waste (which argues for tight-fitting sizes).
//
// The smallest unit of allocation is 256 bytes.
diff --git a/tensorflow/core/common_runtime/gpu/gpu_stream_util.cc b/tensorflow/core/common_runtime/gpu/gpu_stream_util.cc
index fc9c080d79..91df7b35c1 100644
--- a/tensorflow/core/common_runtime/gpu/gpu_stream_util.cc
+++ b/tensorflow/core/common_runtime/gpu/gpu_stream_util.cc
@@ -61,7 +61,7 @@ Status AssignStreams(const Graph* graph, const AssignStreamsOpts& opts,
}
}
}
- // We perform stream assigmnent assuming a large number of
+ // We perform stream assignment assuming a large number of
// stream IDs and then map these down to the required number of streams
// using simple round-robin.
// Stream Assignment strategy:
diff --git a/tensorflow/core/common_runtime/gpu/gpu_util.h b/tensorflow/core/common_runtime/gpu/gpu_util.h
index ab9d87186a..b60a4f8018 100644
--- a/tensorflow/core/common_runtime/gpu/gpu_util.h
+++ b/tensorflow/core/common_runtime/gpu/gpu_util.h
@@ -34,7 +34,7 @@ class GPUUtil {
// "tensor" is GPU-local. "dev" is the hosting GPU.
// "device_context" should be the context of the GPU "_Send" op
// which provides the Tensor.
- // Sets all necessasry fields of "proto" by transferring value
+ // Sets all necessary fields of "proto" by transferring value
// bytes from GPU to CPU RAM. "is_dead" indicates that the
// tensor is dead with an uninit value.
static void SetProtoFromGPU(const Tensor& tensor, Device* dev,
diff --git a/tensorflow/core/common_runtime/gpu/pool_allocator.cc b/tensorflow/core/common_runtime/gpu/pool_allocator.cc
index 548463f725..b855301868 100644
--- a/tensorflow/core/common_runtime/gpu/pool_allocator.cc
+++ b/tensorflow/core/common_runtime/gpu/pool_allocator.cc
@@ -47,7 +47,7 @@ PoolAllocator::PoolAllocator(size_t pool_size_limit, bool auto_resize,
PoolAllocator::~PoolAllocator() { Clear(); }
namespace {
-// Pools contain Chunks allocatated from the underlying Allocator.
+// Pools contain Chunks allocated from the underlying Allocator.
// Chunk alignment is always on kPoolAlignment boundaries. Each Chunk
// begins with a descriptor (ChunkPrefix) that gives its size and a
// pointer to itself. The pointer returned to the user is just past
@@ -56,7 +56,7 @@ namespace {
// pointer and also re-write the ChunkPrefix.chunk_ptr value
// immediately before it. This way the Chunk address and size can be
// recovered from the returned user pointer, regardless of alignment.
-// Note that this deferencing of the pointers means that we cannot
+// Note that this dereferencing of the pointers means that we cannot
// handle GPU memory, only CPU memory.
struct ChunkPrefix {
size_t num_bytes;
diff --git a/tensorflow/core/common_runtime/gpu/process_state.cc b/tensorflow/core/common_runtime/gpu/process_state.cc
index 8a5788ff2f..171e1f56b0 100644
--- a/tensorflow/core/common_runtime/gpu/process_state.cc
+++ b/tensorflow/core/common_runtime/gpu/process_state.cc
@@ -47,7 +47,7 @@ const bool FLAGS_brain_gpu_region_allocator_reset_to_nan = false;
const bool FLAGS_brain_gpu_use_bfc_allocator = true;
// If true, record attributes of memory allocations and
-// dyanmically check for appropriate use of registered memory.
+// dynamically check for appropriate use of registered memory.
// Should only be true for debugging or diagnosis of
// performance issues.
bool FLAGS_brain_gpu_record_mem_types = false;
diff --git a/tensorflow/core/common_runtime/gpu/process_state.h b/tensorflow/core/common_runtime/gpu/process_state.h
index 18fac6219b..498a38caac 100644
--- a/tensorflow/core/common_runtime/gpu/process_state.h
+++ b/tensorflow/core/common_runtime/gpu/process_state.h
@@ -67,7 +67,7 @@ class ProcessState {
MemDesc PtrType(const void* ptr);
// Returns the one CPUAllocator used for the given numa_node.
- // TEMPORY: ignores numa_node.
+ // TEMPORARY: ignores numa_node.
Allocator* GetCPUAllocator(int numa_node);
// Returns the one GPU allocator used for the indexed GPU.
@@ -80,7 +80,7 @@ class ProcessState {
// used on that first call is used.
//
// "Allocator type" describes the type of algorithm to use for the
- // underlying allocator. REQURES: Must be a valid type (see
+ // underlying allocator. REQUIRES: Must be a valid type (see
// config.proto for the list of supported strings.).
//
// REQUIRES: gpu_id must be a valid ordinal for a GPU available in the
@@ -98,7 +98,7 @@ class ProcessState {
// interface to be used for network device memory registration.
// "bus_id" is platform-specific. On many platforms it
// should be 0. On machines with multiple PCIe buses, it should be
- // the index of one of the PCIe buses. If the the bus_id is invalid,
+ // the index of one of the PCIe buses. If the bus_id is invalid,
// results are undefined.
typedef std::function<void(void*, size_t)> AllocVisitor;
void AddGPUAllocVisitor(int bus_id, AllocVisitor visitor);
diff --git a/tensorflow/core/common_runtime/kernel_benchmark_testlib.h b/tensorflow/core/common_runtime/kernel_benchmark_testlib.h
index 592e68392f..46ba735a05 100644
--- a/tensorflow/core/common_runtime/kernel_benchmark_testlib.h
+++ b/tensorflow/core/common_runtime/kernel_benchmark_testlib.h
@@ -29,7 +29,7 @@ limitations under the License.
namespace tensorflow {
class Device;
-class SessionOptions;
+struct SessionOptions;
namespace test {
diff --git a/tensorflow/core/common_runtime/local_device.h b/tensorflow/core/common_runtime/local_device.h
index 850d41ee6d..d98218e90c 100644
--- a/tensorflow/core/common_runtime/local_device.h
+++ b/tensorflow/core/common_runtime/local_device.h
@@ -22,7 +22,7 @@ limitations under the License.
namespace tensorflow {
-class SessionOptions;
+struct SessionOptions;
// This class is shared by ThreadPoolDevice and GPUDevice and
// initializes a shared Eigen compute device used by both. This
diff --git a/tensorflow/core/common_runtime/session_factory.h b/tensorflow/core/common_runtime/session_factory.h
index fddefbe52e..2d16491b50 100644
--- a/tensorflow/core/common_runtime/session_factory.h
+++ b/tensorflow/core/common_runtime/session_factory.h
@@ -25,7 +25,7 @@ limitations under the License.
namespace tensorflow {
class Session;
-class SessionOptions;
+struct SessionOptions;
class SessionFactory {
public:
diff --git a/tensorflow/core/common_runtime/simple_placer.cc b/tensorflow/core/common_runtime/simple_placer.cc
index 1908eb41b4..33a7a63107 100644
--- a/tensorflow/core/common_runtime/simple_placer.cc
+++ b/tensorflow/core/common_runtime/simple_placer.cc
@@ -37,7 +37,7 @@ namespace {
// types in 'supported_device_types' and returns the *first* subset of devices
// that match.
//
-// For example, if suported_device_types contains {GPU, CPU} and
+// For example, if supported_device_types contains {GPU, CPU} and
// 'devices' contains CPU and GPU devices, the returned vector will
// include *only* GPU devices, since that is higher in the priority
// order in 'supported_device_types'.
diff --git a/tensorflow/core/framework/attr_value_util.h b/tensorflow/core/framework/attr_value_util.h
index 996d54d49f..10833054b7 100644
--- a/tensorflow/core/framework/attr_value_util.h
+++ b/tensorflow/core/framework/attr_value_util.h
@@ -36,7 +36,7 @@ string SummarizeAttrValue(const AttrValue& attr_value);
// Generates an error if attr_value doesn't have the indicated attr type.
Status AttrValueHasType(const AttrValue& attr_value, StringPiece type);
-// Converts a text proto value from "text" into the the field of *out
+// Converts a text proto value from "text" into the field of *out
// indicated by "type" (e.g. from the type field of an AttrDef).
// Examples:
// * If type:"int" and text:"-14", then *out is set to "i: -14"
diff --git a/tensorflow/core/framework/function.proto b/tensorflow/core/framework/function.proto
index 4b8a26947c..294d66cf80 100644
--- a/tensorflow/core/framework/function.proto
+++ b/tensorflow/core/framework/function.proto
@@ -61,7 +61,7 @@ message FunctionDef {
// 'attr' maps names defined by 'func's attr defs to attr values.
// attr values may have placeholders which are substituted
// recursively by concrete values when this node is instantiated.
- // These placeholdes must name an attr listed in the FunctionDef's
+ // These placeholders must name an attr listed in the FunctionDef's
// signature.
map<string, AttrValue> attr = 5;
}
diff --git a/tensorflow/core/framework/function_test.cc b/tensorflow/core/framework/function_test.cc
index 433ac005b5..fa64ef1fdf 100644
--- a/tensorflow/core/framework/function_test.cc
+++ b/tensorflow/core/framework/function_test.cc
@@ -296,8 +296,8 @@ REGISTER_OP("Cond")
output = Cond(input) ? then_branch(input) : else_branch(input)
cond: A function takes 'input' and returns a scalar.
-then_branch: A funcion takes 'input' and returns 'output'.
-else_branch: A funcion takes 'input' and returns 'output'.
+then_branch: A function takes 'input' and returns 'output'.
+else_branch: A function takes 'input' and returns 'output'.
)doc");
TEST(TFunc, Body_Array_List_Converter) {
diff --git a/tensorflow/core/framework/node_def_util.h b/tensorflow/core/framework/node_def_util.h
index 0402631b06..4ebfd9a16c 100644
--- a/tensorflow/core/framework/node_def_util.h
+++ b/tensorflow/core/framework/node_def_util.h
@@ -146,7 +146,7 @@ Status ValidateNodeDef(const NodeDef& node_def, const OpDef& op_def);
// Computes the mapping from input/output argument name to the
// corresponding input/output index range. For example,
-// input "foo" coresponds to input indices
+// input "foo" corresponds to input indices
// [ (*inputs)["foo"].first, (*inputs)["foo"].second ).
typedef std::unordered_map<string, std::pair<int, int>> NameRangeMap;
Status NameRangesForNode(const NodeDef& node_def, const OpDef& op_def,
diff --git a/tensorflow/core/framework/op.h b/tensorflow/core/framework/op.h
index 558afcf4ac..6d329f7ff2 100644
--- a/tensorflow/core/framework/op.h
+++ b/tensorflow/core/framework/op.h
@@ -72,7 +72,7 @@ class OpRegistry : public OpRegistryInterface {
const OpDef* LookUp(const string& op_type_name,
Status* status) const override;
- // Fills *ops with all registered OpDefss (except those with names
+ // Fills *ops with all registered OpDefs (except those with names
// starting with '_' if include_internal == false).
void Export(bool include_internal, OpList* ops) const;
diff --git a/tensorflow/core/framework/op_compatibility_test.cc b/tensorflow/core/framework/op_compatibility_test.cc
index d6b51242c7..083dc6f30f 100644
--- a/tensorflow/core/framework/op_compatibility_test.cc
+++ b/tensorflow/core/framework/op_compatibility_test.cc
@@ -53,7 +53,7 @@ class OpCompatibilityTest : public OpsTestBase {
ASSERT_OK(InOutTypesForNode(*node_def(), old_op_def, &old_in_types,
&old_out_types));
- // This should be all that is needed to get compatiblity.
+ // This should be all that is needed to get compatibility.
const OpDef* new_op_def = RegisteredOpDef();
AddDefaultsToNodeDef(*new_op_def, node_def());
@@ -93,7 +93,7 @@ class OpCompatibilityTest : public OpsTestBase {
ASSERT_OK(InOutTypesForNode(*node_def(), old_op_def, &old_in_types,
&old_out_types));
- // This should be all that is needed to get compatiblity.
+ // This should be all that is needed to get compatibility.
const OpDef* new_op_def = RegisteredOpDef();
AddDefaultsToNodeDef(*new_op_def, node_def());
@@ -117,7 +117,7 @@ class OpCompatibilityTest : public OpsTestBase {
ASSERT_OK(InOutTypesForNode(*node_def(), old_op_def, &old_in_types,
&old_out_types));
- // This should be all that is needed to get compatiblity.
+ // This should be all that is needed to get compatibility.
const OpDef* new_op_def = RegisteredOpDef();
AddDefaultsToNodeDef(*new_op_def, node_def());
diff --git a/tensorflow/core/framework/op_def_builder.h b/tensorflow/core/framework/op_def_builder.h
index 93cdad6f4f..4b8482d46a 100644
--- a/tensorflow/core/framework/op_def_builder.h
+++ b/tensorflow/core/framework/op_def_builder.h
@@ -64,7 +64,7 @@ class OpDefBuilder {
// Perhaps by linking the type of the tensor to a type attr?
OpDefBuilder& Attr(StringPiece spec);
- // Adds an input or ouput to this OpDefBuilder (and returns *this).
+ // Adds an input or output to this OpDefBuilder (and returns *this).
// The spec has form "<name>:<type-expr>" or "<name>:Ref(<type-expr>)"
// where <name> matches regexp [a-z][a-z0-9_]* and <type-expr> can be:
// * For a single tensor: <type>
diff --git a/tensorflow/core/framework/op_kernel.h b/tensorflow/core/framework/op_kernel.h
index 671c6de04f..683ca78b62 100644
--- a/tensorflow/core/framework/op_kernel.h
+++ b/tensorflow/core/framework/op_kernel.h
@@ -578,7 +578,7 @@ class OpKernelContext {
Status mutable_input(const string& name, Tensor* tensor, bool lock_held);
// Returns the named list-valued mutable input in "list", as defined
- // in the OpDef. If the named intput is not list-valued, returns a
+ // in the OpDef. If the named input is not list-valued, returns a
// one-element list. Must be used to access Ref inputs. The values
// stored in the Tensor buffer may be modified, and modifications
// will be visible to other Ops reading the same ref tensor.
diff --git a/tensorflow/core/framework/reader_interface.h b/tensorflow/core/framework/reader_interface.h
index 0f309fe722..1992af5f7c 100644
--- a/tensorflow/core/framework/reader_interface.h
+++ b/tensorflow/core/framework/reader_interface.h
@@ -50,7 +50,7 @@ class ReaderInterface : public ResourceBase {
public:
// Read a single record into *key / *value. May get more work from
// *queue if the current work is complete. Sets the status on
- // *context with an OutOfRange Status if the the current work is
+ // *context with an OutOfRange Status if the current work is
// complete and the queue is done (closed and empty).
// This method may block.
virtual void Read(QueueInterface* queue, string* key, string* value,
diff --git a/tensorflow/core/framework/rendezvous.h b/tensorflow/core/framework/rendezvous.h
index 967b597fcf..b026dabe25 100644
--- a/tensorflow/core/framework/rendezvous.h
+++ b/tensorflow/core/framework/rendezvous.h
@@ -44,7 +44,7 @@ class Rendezvous : public core::RefCounted {
AllocatorAttributes alloc_attrs;
};
- // Constructs a rendezvouz key for the tensor of "name" sent from
+ // Constructs a rendezvous key for the tensor of "name" sent from
// "src_device" to "dst_device". The tensor is generated in the frame
// and iteration specified by "frame_iter".
static string CreateKey(const string& src_device, uint64 src_incarnation,
diff --git a/tensorflow/core/framework/tensor.proto b/tensorflow/core/framework/tensor.proto
index a47c7b7e0e..a1cf9489f0 100644
--- a/tensorflow/core/framework/tensor.proto
+++ b/tensorflow/core/framework/tensor.proto
@@ -24,8 +24,8 @@ message TensorProto {
// to represent a constant Tensor with a single value.
int32 version_number = 3;
- // Serialized content from TensorBase::Serialize() This representation can be
- // used for all tensor types.
+ // Serialized content from Tensor::AsProtoTensorContent(). This representation
+ // can be used for all tensor types.
bytes tensor_content = 4;
// Type specific representations that make it easy to create tensor protos in
diff --git a/tensorflow/core/framework/tensor_slice.h b/tensorflow/core/framework/tensor_slice.h
index a0b2defb83..15d9beed1e 100644
--- a/tensorflow/core/framework/tensor_slice.h
+++ b/tensorflow/core/framework/tensor_slice.h
@@ -38,7 +38,7 @@ class TensorSlice {
// -- from just a dimension (in this case it will create a full slice)
// -- from an array of pairs of integers.
// -- from a TensorSliceProto protocol buffer
- // -- from a string format of "start,lenth:start,length..." where each
+ // -- from a string format of "start,length:start,length..." where each
// "start,length" pair represents the slice on one dimension. We allow a
// special "-" that means "everything for this dimension". One such example
// is: 0,10:-:14,1:-:-
diff --git a/tensorflow/core/framework/tensor_testutil.h b/tensorflow/core/framework/tensor_testutil.h
index 502bdc1f20..f47c8a9f3f 100644
--- a/tensorflow/core/framework/tensor_testutil.h
+++ b/tensorflow/core/framework/tensor_testutil.h
@@ -84,7 +84,7 @@ template <typename T>
void ExpectTensorEqual(const Tensor& x, const Tensor& y);
// Expects "x" and "y" are tensors of the same type, same shape, and
-// approxmiate equal values, each within "abs_err".
+// approximate equal values, each within "abs_err".
template <typename T>
void ExpectTensorNear(const Tensor& x, const Tensor& y, const T& abs_err);
diff --git a/tensorflow/core/kernels/adjust_contrast_op.h b/tensorflow/core/kernels/adjust_contrast_op.h
index 2fdb2dd9a6..46dbf0ce01 100644
--- a/tensorflow/core/kernels/adjust_contrast_op.h
+++ b/tensorflow/core/kernels/adjust_contrast_op.h
@@ -38,14 +38,11 @@ struct AdjustContrast {
Eigen::array<int, 4> scalar_broadcast{{batch, height, width, channels}};
#if !defined(EIGEN_HAS_INDEX_LIST)
Eigen::array<int, 2> reduction_axis{{1, 2}};
- Eigen::array<int, 4> scalar{{1, 1, 1, 1}};
Eigen::array<int, 4> broadcast_dims{{1, height, width, 1}};
Eigen::Tensor<int, 4>::Dimensions reshape_dims{{batch, 1, 1, channels}};
#else
Eigen::IndexList<Eigen::type2index<1>, Eigen::type2index<2> >
reduction_axis;
- Eigen::IndexList<Eigen::type2index<1>, Eigen::type2index<1>,
- Eigen::type2index<1>, Eigen::type2index<1> > scalar;
Eigen::IndexList<Eigen::type2index<1>, int, int, Eigen::type2index<1> >
broadcast_dims;
broadcast_dims.set(1, height);
@@ -55,6 +52,7 @@ struct AdjustContrast {
reshape_dims.set(0, batch);
reshape_dims.set(3, channels);
#endif
+ Eigen::Sizes<1, 1, 1, 1> scalar;
float num_reduced_coeffs = height * width;
mean_values.device(d) =
(input.template cast<float>().sum(reduction_axis).eval() /
@@ -88,16 +86,12 @@ struct AdjustContrastv2 {
Eigen::array<int, 4> scalar_broadcast{{batch, height, width, channels}};
#if !defined(EIGEN_HAS_INDEX_LIST)
Eigen::array<int, 2> reduction_axis{{0, 1}};
- Eigen::array<int, 4> scalar{{1, 1, 1, 1}};
Eigen::array<int, 4> broadcast_dims{{1, height, width, 1}};
Eigen::Tensor<int, 4>::Dimensions reshape_dims{{batch, 1, 1, channels}};
Eigen::array<int, 4> reduced_dims_first{{1, 2, 0, 3}};
#else
Eigen::IndexList<Eigen::type2index<0>, Eigen::type2index<1> >
reduction_axis;
- Eigen::IndexList<Eigen::type2index<1>, Eigen::type2index<1>,
- Eigen::type2index<1>, Eigen::type2index<1> >
- scalar;
Eigen::IndexList<Eigen::type2index<1>, int, int, Eigen::type2index<1> >
broadcast_dims;
broadcast_dims.set(1, height);
@@ -110,6 +104,7 @@ struct AdjustContrastv2 {
Eigen::type2index<0>, Eigen::type2index<3> >
reduced_dims_first;
#endif
+ Eigen::Sizes<1, 1, 1, 1> scalar;
float num_reduced_coeffs = height * width;
output.device(d) =
(input.shuffle(reduced_dims_first).sum(reduction_axis).eval() /
diff --git a/tensorflow/core/kernels/check_numerics_op.cc b/tensorflow/core/kernels/check_numerics_op.cc
index 976ca4984b..e453d9ca6a 100644
--- a/tensorflow/core/kernels/check_numerics_op.cc
+++ b/tensorflow/core/kernels/check_numerics_op.cc
@@ -17,6 +17,7 @@ limitations under the License.
#include <math.h>
#include <algorithm>
+#include <numeric>
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/types.h"
diff --git a/tensorflow/core/kernels/serialize_sparse_op.cc b/tensorflow/core/kernels/serialize_sparse_op.cc
index 68ff49b93d..00a71a1048 100644
--- a/tensorflow/core/kernels/serialize_sparse_op.cc
+++ b/tensorflow/core/kernels/serialize_sparse_op.cc
@@ -16,6 +16,7 @@ limitations under the License.
#define EIGEN_USE_THREADS
#include <algorithm>
+#include <numeric>
#include <unordered_map>
#include <utility>
#include <vector>
diff --git a/tensorflow/core/kernels/sparse_concat_op.cc b/tensorflow/core/kernels/sparse_concat_op.cc
index 328d7664c9..6413b9a226 100644
--- a/tensorflow/core/kernels/sparse_concat_op.cc
+++ b/tensorflow/core/kernels/sparse_concat_op.cc
@@ -16,6 +16,7 @@ limitations under the License.
#define EIGEN_USE_THREADS
#include <algorithm>
+#include <numeric>
#include <unordered_map>
#include <utility>
#include <vector>
diff --git a/tensorflow/core/kernels/sparse_reorder_op.cc b/tensorflow/core/kernels/sparse_reorder_op.cc
index 7cbd384ba2..4d4318ff7f 100644
--- a/tensorflow/core/kernels/sparse_reorder_op.cc
+++ b/tensorflow/core/kernels/sparse_reorder_op.cc
@@ -16,6 +16,7 @@ limitations under the License.
#define EIGEN_USE_THREADS
#include <algorithm>
+#include <numeric>
#include <unordered_map>
#include <utility>
diff --git a/tensorflow/core/kernels/sparse_to_dense_op.cc b/tensorflow/core/kernels/sparse_to_dense_op.cc
index 5db0d306a7..3a3fc3f049 100644
--- a/tensorflow/core/kernels/sparse_to_dense_op.cc
+++ b/tensorflow/core/kernels/sparse_to_dense_op.cc
@@ -20,6 +20,7 @@ limitations under the License.
#define EIGEN_USE_THREADS
+#include <numeric>
#include <sstream>
#include <string>
#include <unordered_map>
diff --git a/tensorflow/core/ops/functional_ops.cc b/tensorflow/core/ops/functional_ops.cc
index 5c83e9be5e..35ced2d5e3 100644
--- a/tensorflow/core/ops/functional_ops.cc
+++ b/tensorflow/core/ops/functional_ops.cc
@@ -44,7 +44,7 @@ then, g is
dL/dy1, dL/dy2, ..., dL/dy_M),
where L is a scalar-value function of (x1, x2, ..., xN) (e.g., the
-loss function). dL/dx_i is the the partial derivative of L with respect
+loss function). dL/dx_i is the partial derivative of L with respect
to x_i.
(Needs some math expert to say the comment above better.)
diff --git a/tensorflow/core/ops/io_ops.cc b/tensorflow/core/ops/io_ops.cc
index e6d18c9bb8..468205deeb 100644
--- a/tensorflow/core/ops/io_ops.cc
+++ b/tensorflow/core/ops/io_ops.cc
@@ -146,7 +146,7 @@ REGISTER_OP("ShardedFilename")
.Input("num_shards: int32")
.Output("filename: string")
.Doc(R"doc(
-Generate a sharded filename. The filename is printf formated as
+Generate a sharded filename. The filename is printf formatted as
%s-%05d-of-%05d, basename, shard, num_shards.
)doc");
diff --git a/tensorflow/core/ops/math_grad.cc b/tensorflow/core/ops/math_grad.cc
index 1a19139452..84255c4da2 100644
--- a/tensorflow/core/ops/math_grad.cc
+++ b/tensorflow/core/ops/math_grad.cc
@@ -485,7 +485,7 @@ Status MinMaxGradHelper(const string& op, const AttrSlice& attrs,
// Attr defs
{{"T: {float, double}"}},
{
- // keep_dims because we need to do x == y, which requries x
+ // keep_dims because we need to do x == y, which requires x
// and y are broadcastable.
{{"y"}, op, {"x", "i"}, {{"T", "$T"}, {"keep_dims", true}}},
{{"mask"}, "Equal", {"x", "y"}, {{"T", "$T"}}},
diff --git a/tensorflow/core/ops/nn_ops.cc b/tensorflow/core/ops/nn_ops.cc
index 8c6a274cbb..83f28bdacf 100644
--- a/tensorflow/core/ops/nn_ops.cc
+++ b/tensorflow/core/ops/nn_ops.cc
@@ -168,7 +168,7 @@ performs the following:
1. Flattens the filter to a 2-D matrix with shape
`[filter_height * filter_width * in_channels, output_channels]`.
-2. Extracts image patches from the the input tensor to form a *virtual*
+2. Extracts image patches from the input tensor to form a *virtual*
tensor of shape `[batch, out_height, out_width,
filter_height * filter_width * in_channels]`.
3. For each patch, right-multiplies the filter matrix and the image patch
diff --git a/tensorflow/core/ops/ops.pbtxt b/tensorflow/core/ops/ops.pbtxt
index bd88b5bc59..a07cc20db4 100644
--- a/tensorflow/core/ops/ops.pbtxt
+++ b/tensorflow/core/ops/ops.pbtxt
@@ -1712,7 +1712,7 @@ op {
}
}
summary: "Computes a 2-D convolution given 4-D `input` and `filter` tensors."
- description: "Given an input tensor of shape `[batch, in_height, in_width, in_channels]`\nand a filter / kernel tensor of shape\n`[filter_height, filter_width, in_channels, out_channels]`, this op\nperforms the following:\n\n1. Flattens the filter to a 2-D matrix with shape\n `[filter_height * filter_width * in_channels, output_channels]`.\n2. Extracts image patches from the the input tensor to form a *virtual*\n tensor of shape `[batch, out_height, out_width,\n filter_height * filter_width * in_channels]`.\n3. For each patch, right-multiplies the filter matrix and the image patch\n vector.\n\nIn detail,\n\n output[b, i, j, k] =\n sum_{di, dj, q} input[b, strides[1] * i + di, strides[2] * j + dj, q] *\n filter[di, dj, q, k]\n\nMust have `strides[0] = strides[3] = 1`. For the most common case of the same\nhorizontal and vertices strides, `strides = [1, stride, stride, 1]`."
+ description: "Given an input tensor of shape `[batch, in_height, in_width, in_channels]`\nand a filter / kernel tensor of shape\n`[filter_height, filter_width, in_channels, out_channels]`, this op\nperforms the following:\n\n1. Flattens the filter to a 2-D matrix with shape\n `[filter_height * filter_width * in_channels, output_channels]`.\n2. Extracts image patches from the input tensor to form a *virtual*\n tensor of shape `[batch, out_height, out_width,\n filter_height * filter_width * in_channels]`.\n3. For each patch, right-multiplies the filter matrix and the image patch\n vector.\n\nIn detail,\n\n output[b, i, j, k] =\n sum_{di, dj, q} input[b, strides[1] * i + di, strides[2] * j + dj, q] *\n filter[di, dj, q, k]\n\nMust have `strides[0] = strides[3] = 1`. For the most common case of the same\nhorizontal and vertices strides, `strides = [1, stride, stride, 1]`."
}
op {
name: "Conv2DBackpropFilter"
@@ -4782,7 +4782,7 @@ op {
attr {
name: "num_negative_samples"
type: "int"
- description: "Number of negative samples per exaple."
+ description: "Number of negative samples per example."
}
summary: "Training via negative sampling."
}
@@ -5029,7 +5029,7 @@ op {
attr {
name: "dense_shapes"
type: "list(shape)"
- description: "A list of Ndense shapes; the shapes of data in each Feature\ngiven in dense_keys.\nThe number of elements in the Feature corresponding to dense_key[j]\nmust always equal dense_shapes[j].NumEntries().\nIf dense_shapes[j] == (D0, D1, ..., DN) then the the shape of output\nTensor dense_values[j] will be (|serialized|, D0, D1, ..., DN):\nThe dense outputs are just the inputs row-stacked by batch."
+ description: "A list of Ndense shapes; the shapes of data in each Feature\ngiven in dense_keys.\nThe number of elements in the Feature corresponding to dense_key[j]\nmust always equal dense_shapes[j].NumEntries().\nIf dense_shapes[j] == (D0, D1, ..., DN) then the shape of output\nTensor dense_values[j] will be (|serialized|, D0, D1, ..., DN):\nThe dense outputs are just the inputs row-stacked by batch."
has_minimum: true
}
summary: "Transforms a vector of brain.Example protos (as strings) into typed tensors."
@@ -7480,7 +7480,7 @@ op {
name: "filename"
type: DT_STRING
}
- summary: "Generate a sharded filename. The filename is printf formated as"
+ summary: "Generate a sharded filename. The filename is printf formatted as"
description: " %s-%05d-of-%05d, basename, shard, num_shards."
}
op {
@@ -8852,7 +8852,7 @@ op {
attr {
name: "f"
type: "func"
- description: "The function we want to compute the gradient for.\n\nThe function \'f\' must be a numerical function which takes N inputs and\nproduces M outputs. Its gradient function \'g\', which is computed by\nthis SymbolicGradient op is a function taking N + M inputs and\nproduces N outputs.\n\nI.e. if we have\n (y1, y2, ..., y_M) = f(x1, x2, ..., x_N),\nthen, g is\n (dL/dx1, dL/dx2, ..., dL/dx_N) = g(x1, x2, ..., x_N,\n dL/dy1, dL/dy2, ..., dL/dy_M),\n\nwhere L is a scalar-value function of (x1, x2, ..., xN) (e.g., the\nloss function). dL/dx_i is the the partial derivative of L with respect\nto x_i.\n\n(Needs some math expert to say the comment above better.)"
+ description: "The function we want to compute the gradient for.\n\nThe function \'f\' must be a numerical function which takes N inputs and\nproduces M outputs. Its gradient function \'g\', which is computed by\nthis SymbolicGradient op is a function taking N + M inputs and\nproduces N outputs.\n\nI.e. if we have\n (y1, y2, ..., y_M) = f(x1, x2, ..., x_N),\nthen, g is\n (dL/dx1, dL/dx2, ..., dL/dx_N) = g(x1, x2, ..., x_N,\n dL/dy1, dL/dy2, ..., dL/dy_M),\n\nwhere L is a scalar-value function of (x1, x2, ..., xN) (e.g., the\nloss function). dL/dx_i is the partial derivative of L with respect\nto x_i.\n\n(Needs some math expert to say the comment above better.)"
}
summary: "Computes the gradient function for function f via backpropagation."
}
diff --git a/tensorflow/core/ops/parsing_ops.cc b/tensorflow/core/ops/parsing_ops.cc
index c55d99baf7..6f6381d4c5 100644
--- a/tensorflow/core/ops/parsing_ops.cc
+++ b/tensorflow/core/ops/parsing_ops.cc
@@ -71,7 +71,7 @@ dense_shapes: A list of Ndense shapes; the shapes of data in each Feature
given in dense_keys.
The number of elements in the Feature corresponding to dense_key[j]
must always equal dense_shapes[j].NumEntries().
- If dense_shapes[j] == (D0, D1, ..., DN) then the the shape of output
+ If dense_shapes[j] == (D0, D1, ..., DN) then the shape of output
Tensor dense_values[j] will be (|serialized|, D0, D1, ..., DN):
The dense outputs are just the inputs row-stacked by batch.
sparse_keys: A list of Nsparse string Tensors (scalars).
diff --git a/tensorflow/core/platform/tracing.h b/tensorflow/core/platform/tracing.h
index 0e334bef4d..449123c841 100644
--- a/tensorflow/core/platform/tracing.h
+++ b/tensorflow/core/platform/tracing.h
@@ -37,7 +37,7 @@ class Tracing {
public:
// This enumeration contains the identifiers of all TensorFlow
// threadscape events and code regions. Threadscape assigns its
- // own identiers at runtime when we register our events and we
+ // own identifiers at runtime when we register our events and we
// cannot know in advance what IDs it will choose. The "RecordEvent"
// method and "ScopedActivity" use these event IDs for consistency
// and remap them to threadscape IDs at runtime. This enum is limited
diff --git a/tensorflow/core/public/tensor_c_api.h b/tensorflow/core/public/tensor_c_api.h
index 22219d1413..4bd53c365e 100644
--- a/tensorflow/core/public/tensor_c_api.h
+++ b/tensorflow/core/public/tensor_c_api.h
@@ -30,7 +30,7 @@ limitations under the License.
// * Objects are always passed around as pointers to opaque structs
// and these structs are allocated/deallocated via the API.
// * TF_Status holds error information. It is an object type
-// and threfore is passed around as a pointer to an opaque
+// and therefore is passed around as a pointer to an opaque
// struct as mentioned above.
// * Every call that has a TF_Status* argument clears it on success
// and fills it with error info on failure.
diff --git a/tensorflow/core/util/sparse/sparse_tensor.h b/tensorflow/core/util/sparse/sparse_tensor.h
index 42896df234..1c3a06693f 100644
--- a/tensorflow/core/util/sparse/sparse_tensor.h
+++ b/tensorflow/core/util/sparse/sparse_tensor.h
@@ -212,7 +212,7 @@ class SparseTensor {
}
}
- // Helper for Split() that retuerns the shape given a slice index.
+ // Helper for Split() that returns the shape given a slice index.
static inline int GetSliceShape(const int slice_index, const int split_size,
const int residual) {
CHECK_GT(split_size, 0);
diff --git a/tensorflow/core/util/tensor_slice_set.cc b/tensorflow/core/util/tensor_slice_set.cc
index 3b1d6287a7..c6546d98a8 100644
--- a/tensorflow/core/util/tensor_slice_set.cc
+++ b/tensorflow/core/util/tensor_slice_set.cc
@@ -62,8 +62,8 @@ bool TensorSliceSet::Query(const TensorSlice& slice, float* data) const {
}
return true;
} else {
- // We didn't find any exact match but there is still a posibility that
- // mutliple existing slices can be patched together to output the slice.
+ // We didn't find any exact match but there is still a possibility that
+ // multiple existing slices can be patched together to output the slice.
// We figure this out by computing the intersection of each of the existing
// slices with the query slice, and check if the union of all these
// intersections cover the entire slice. We rely on the fact that the
@@ -119,7 +119,7 @@ bool TensorSliceSet::QueryMeta(
results->emplace_back(std::make_pair(info->slice, info->tag));
return true;
} else {
- // We didn't find any exact match but there is still a posibility that
+ // We didn't find any exact match but there is still a possibility that
// multiple existing slices can be patched together to output the slice.
// We figure this out by computing the intersection of each of the existing
// slices with the query slice, and check if the union of all these
diff --git a/tensorflow/core/util/tensor_slice_set.h b/tensorflow/core/util/tensor_slice_set.h
index 463b704cc5..4747968622 100644
--- a/tensorflow/core/util/tensor_slice_set.h
+++ b/tensorflow/core/util/tensor_slice_set.h
@@ -57,7 +57,7 @@ class TensorSliceSet {
// Query about a new slice: checks if we have data for "slice" and if we have
// the data and "data" is not nullptr, fill "data" with the slice data. The
- // caller needs to make sure "data" point to a large eough buffer.
+ // caller needs to make sure "data" point to a large enough buffer.
// TODO(yangke): avoid unnecessary copying by using a core::RefCounted
// pointer.
bool Query(const TensorSlice& slice, float* data) const;
diff --git a/tensorflow/core/util/use_cudnn.h b/tensorflow/core/util/use_cudnn.h
index 5e4dd8bae3..becbec3de1 100644
--- a/tensorflow/core/util/use_cudnn.h
+++ b/tensorflow/core/util/use_cudnn.h
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
-// The utility to check whether we have Cudnn depenedency.
+// The utility to check whether we have Cudnn dependency.
#ifndef TENSORFLOW_UTIL_USE_CUDNN_H_
#define TENSORFLOW_UTIL_USE_CUDNN_H_
diff --git a/tensorflow/examples/tutorials/mnist/fully_connected_feed.py b/tensorflow/examples/tutorials/mnist/fully_connected_feed.py
index 3f5beff6c5..7a4f8f6023 100644
--- a/tensorflow/examples/tutorials/mnist/fully_connected_feed.py
+++ b/tensorflow/examples/tutorials/mnist/fully_connected_feed.py
@@ -46,7 +46,7 @@ flags.DEFINE_boolean('fake_data', False, 'If true, uses fake data '
def placeholder_inputs(batch_size):
- """Generate placeholder variables to represent the the input tensors.
+ """Generate placeholder variables to represent the input tensors.
These placeholders are used as inputs by the rest of the model building
code and will be fed from the downloaded data in the .run() loop, below.
diff --git a/tensorflow/examples/tutorials/mnist/mnist.py b/tensorflow/examples/tutorials/mnist/mnist.py
index 096344e0b4..72629e959d 100644
--- a/tensorflow/examples/tutorials/mnist/mnist.py
+++ b/tensorflow/examples/tutorials/mnist/mnist.py
@@ -94,7 +94,7 @@ def loss(logits, labels):
Returns:
loss: Loss tensor of type float.
"""
- # Convert from sparse integer labels in the range [0, NUM_CLASSSES)
+ # Convert from sparse integer labels in the range [0, NUM_CLASSES)
# to 1-hot dense float vectors (that is we will have batch_size vectors,
# each with NUM_CLASSES values, all of which are 0.0 except there will
# be a 1.0 in the entry corresponding to the label).
diff --git a/tensorflow/examples/tutorials/mnist/mnist_softmax.py b/tensorflow/examples/tutorials/mnist/mnist_softmax.py
index 7853a0a686..362049c27e 100644
--- a/tensorflow/examples/tutorials/mnist/mnist_softmax.py
+++ b/tensorflow/examples/tutorials/mnist/mnist_softmax.py
@@ -13,7 +13,7 @@
# limitations under the License.
# ==============================================================================
-"""A very simple MNIST classifer.
+"""A very simple MNIST classifier.
See extensive documentation at
http://tensorflow.org/tutorials/mnist/beginners/index.md
diff --git a/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py b/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py
index 9e1c0c5d6b..fc6e97387d 100644
--- a/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py
+++ b/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py
@@ -13,12 +13,12 @@
# limitations under the License.
# ==============================================================================
-"""A very simple MNIST classifer, modified to display data in TensorBoard.
+"""A very simple MNIST classifier, modified to display data in TensorBoard.
See extensive documentation for the original model at
http://tensorflow.org/tutorials/mnist/beginners/index.md
-See documentaion on the TensorBoard specific pieces at
+See documentation on the TensorBoard specific pieces at
http://tensorflow.org/how_tos/summaries_and_tensorboard/index.md
If you modify this file, please update the exerpt in
@@ -53,7 +53,7 @@ def main(_):
W = tf.Variable(tf.zeros([784, 10]), name='weights')
b = tf.Variable(tf.zeros([10], name='bias'))
- # use a name scope to organize nodes in the graph visualizer
+ # Use a name scope to organize nodes in the graph visualizer
with tf.name_scope('Wx_b'):
y = tf.nn.softmax(tf.matmul(x, W) + b)
@@ -85,7 +85,7 @@ def main(_):
# Train the model, and feed in test data and record summaries every 10 steps
for i in range(FLAGS.max_steps):
- if i % 10 == 0: # Record summary data, and the accuracy
+ if i % 10 == 0: # Record summary data and the accuracy
if FLAGS.fake_data:
batch_xs, batch_ys = mnist.train.next_batch(
100, fake_data=FLAGS.fake_data)
diff --git a/tensorflow/examples/tutorials/word2vec/word2vec_basic.py b/tensorflow/examples/tutorials/word2vec/word2vec_basic.py
index 714d9dccf4..d8ef3377f8 100644
--- a/tensorflow/examples/tutorials/word2vec/word2vec_basic.py
+++ b/tensorflow/examples/tutorials/word2vec/word2vec_basic.py
@@ -73,7 +73,7 @@ def build_dataset(words):
index = dictionary[word]
else:
index = 0 # dictionary['UNK']
- unk_count = unk_count + 1
+ unk_count += 1
data.append(index)
count[0][1] = unk_count
reverse_dictionary = dict(zip(dictionary.values(), dictionary.keys()))
@@ -87,7 +87,7 @@ print('Sample data', data[:10])
data_index = 0
-# Step 4: Function to generate a training batch for the skip-gram model.
+# Step 3: Function to generate a training batch for the skip-gram model.
def generate_batch(batch_size, num_skips, skip_window):
global data_index
assert batch_size % num_skips == 0
@@ -117,7 +117,7 @@ for i in range(8):
print(batch[i], '->', labels[i, 0])
print(reverse_dictionary[batch[i]], '->', reverse_dictionary[labels[i, 0]])
-# Step 5: Build and train a skip-gram model.
+# Step 4: Build and train a skip-gram model.
batch_size = 128
embedding_size = 128 # Dimension of the embedding vector.
@@ -172,7 +172,7 @@ with graph.as_default():
similarity = tf.matmul(
valid_embeddings, normalized_embeddings, transpose_b=True)
-# Step 6: Begin training
+# Step 5: Begin training.
num_steps = 100001
with tf.Session(graph=graph) as session:
@@ -193,12 +193,12 @@ with tf.Session(graph=graph) as session:
if step % 2000 == 0:
if step > 0:
- average_loss = average_loss / 2000
+ average_loss /= 2000
# The average loss is an estimate of the loss over the last 2000 batches.
print("Average loss at step ", step, ": ", average_loss)
average_loss = 0
- # note that this is expensive (~20% slowdown if computed every 500 steps)
+ # Note that this is expensive (~20% slowdown if computed every 500 steps)
if step % 10000 == 0:
sim = similarity.eval()
for i in xrange(valid_size):
@@ -212,7 +212,7 @@ with tf.Session(graph=graph) as session:
print(log_str)
final_embeddings = normalized_embeddings.eval()
-# Step 7: Visualize the embeddings.
+# Step 6: Visualize the embeddings.
def plot_with_labels(low_dim_embs, labels, filename='tsne.png'):
assert low_dim_embs.shape[0] >= len(labels), "More labels than embeddings"
diff --git a/tensorflow/examples/udacity/1_notmnist.ipynb b/tensorflow/examples/udacity/1_notmnist.ipynb
index 9c9888664c..f39fc0f07a 100644
--- a/tensorflow/examples/udacity/1_notmnist.ipynb
+++ b/tensorflow/examples/udacity/1_notmnist.ipynb
@@ -123,7 +123,7 @@
"outputId": "ef6c790c-2513-4b09-962e-27c79390c762"
},
"cell_type": "code",
- "input": "num_classes = 10\n\ndef extract(filename):\n tar = tarfile.open(filename)\n tar.extractall()\n tar.close()\n root = os.path.splitext(os.path.splitext(filename)[0])[0] # remove .tar.gz\n data_folders = [os.path.join(root, d) for d in sorted(os.listdir(root))]\n if len(data_folders) != num_classes:\n raise Exception(\n 'Expected %d folders, one per class. Found %d instead.' % (\n num_folders, len(data_folders)))\n print data_folders\n return data_folders\n \ntrain_folders = extract(train_filename)\ntest_folders = extract(test_filename)",
+ "input": "num_classes = 10\n\ndef extract(filename):\n tar = tarfile.open(filename)\n tar.extractall()\n tar.close()\n root = os.path.splitext(os.path.splitext(filename)[0])[0] # remove .tar.gz\n data_folders = [os.path.join(root, d) for d in sorted(os.listdir(root))]\n if len(data_folders) != num_classes:\n raise Exception(\n 'Expected %d folders, one per class. Found %d instead.' % (\n num_classes, len(data_folders)))\n print data_folders\n return data_folders\n \ntrain_folders = extract(train_filename)\ntest_folders = extract(test_filename)",
"language": "python",
"outputs": [
{
@@ -393,4 +393,4 @@
},
"nbformat": 3,
"nbformat_minor": 0
-} \ No newline at end of file
+}
diff --git a/tensorflow/examples/udacity/4_convolutions.ipynb b/tensorflow/examples/udacity/4_convolutions.ipynb
index b53cb8115f..2ddc8ca30e 100644
--- a/tensorflow/examples/udacity/4_convolutions.ipynb
+++ b/tensorflow/examples/udacity/4_convolutions.ipynb
@@ -218,7 +218,7 @@
"colab_type": "text"
},
"cell_type": "markdown",
- "source": "---\nProblem 1\n---------\n\nThe convolutional model above uses convolutions with stride 2 to reduce the dimensionality. Replace the strides a max pooling operation (`nn.max_pool()`) of stride 2 and kernel size 2.\n\n---"
+ "source": "---\nProblem 1\n---------\n\nThe convolutional model above uses convolutions with stride 2 to reduce the dimensionality. Replace the strides by a max pooling operation (`nn.max_pool()`) of stride 2 and kernel size 2.\n\n---"
},
{
"metadata": {
@@ -239,4 +239,4 @@
},
"nbformat": 3,
"nbformat_minor": 0
-} \ No newline at end of file
+}
diff --git a/tensorflow/g3doc/api_docs/index.md b/tensorflow/g3doc/api_docs/index.md
index f58624cf51..d074c0ece3 100644
--- a/tensorflow/g3doc/api_docs/index.md
+++ b/tensorflow/g3doc/api_docs/index.md
@@ -6,7 +6,7 @@ and the easiest to use, but the C++ API may offer some performance advantages
in graph execution, and supports deployment to small devices such as Android.
Over time, we hope that the TensorFlow community will develop front ends for
-languages like Go, Java, JavaScript, Lua R, and perhaps others. With
+languages like Go, Java, JavaScript, Lua, R, and perhaps others. With
[SWIG](http://swig.org), it's relatively easy to develop a TensorFlow interface
for your favorite language.
diff --git a/tensorflow/g3doc/api_docs/python/framework.md b/tensorflow/g3doc/api_docs/python/framework.md
index 669e85aafe..c5e3461462 100644
--- a/tensorflow/g3doc/api_docs/python/framework.md
+++ b/tensorflow/g3doc/api_docs/python/framework.md
@@ -917,7 +917,7 @@ c = tf.constant([[1.0, 2.0], [3.0, 4.0]])
d = tf.constant([[1.0, 1.0], [0.0, 1.0]])
e = tf.matmul(c, d)
-# Construct a `Session` to execut the graph.
+# Construct a `Session` to execute the graph.
sess = tf.Session()
# Execute the graph and store the value that `e` represents in `result`.
diff --git a/tensorflow/g3doc/api_docs/python/nn.md b/tensorflow/g3doc/api_docs/python/nn.md
index 52f837aef4..f0fb182074 100644
--- a/tensorflow/g3doc/api_docs/python/nn.md
+++ b/tensorflow/g3doc/api_docs/python/nn.md
@@ -243,7 +243,7 @@ as `'SAME'` or `'VALID'`, the output size and the padding pixels are computed.
For the `'SAME'` padding, the output height and width are computed as:
out_height = ceil(float(in_height) / float(strides[1]))
- out_width = ceil(float(in_width) / float(stides[2]))
+ out_width = ceil(float(in_width) / float(strides[2]))
and the padding on the top and left are computed as:
@@ -265,7 +265,7 @@ same number of pixels on both sides.
For the `'VALID`' padding, the output height and width are computed as:
out_height = ceil(float(in_height - filter_height + 1) / float(strides[1]))
- out_width = ceil(float(in_width - filter_width + 1) / float(stides[2]))
+ out_width = ceil(float(in_width - filter_width + 1) / float(strides[2]))
and the padding values are always zero. The output is then computed as
diff --git a/tensorflow/g3doc/get_started/os_setup.md b/tensorflow/g3doc/get_started/os_setup.md
index 323359f3dc..1b442309f9 100644
--- a/tensorflow/g3doc/get_started/os_setup.md
+++ b/tensorflow/g3doc/get_started/os_setup.md
@@ -269,7 +269,7 @@ The exact location of the Python library depends on your system, but is usually
You can find out the directory with the following command:
```bash
-$ python -c 'import site; print("\n".join(site.getsitepackages()))'
+$ python -c 'import os; import inspect; import tensorflow; print(os.path.dirname(inspect.getfile(tensorflow)))'
```
The simple demo model for classifying handwritten digits from the MNIST dataset
@@ -310,7 +310,7 @@ depends on.
#### Install Bazel
Follow instructions [here](http://bazel.io/docs/install.html) to install the
-dependencies for Bazel. Then download the latest stable bazel version using the
+dependencies for bazel. Then download the latest stable bazel version using the
[installer for your system](https://github.com/bazelbuild/bazel/releases) and
run the installer as mentioned there:
@@ -374,6 +374,7 @@ toolkit is installed in `/usr/local/cuda`:
tar xvzf cudnn-6.5-linux-x64-v2.tgz
sudo cp cudnn-6.5-linux-x64-v2/cudnn.h /usr/local/cuda/include
sudo cp cudnn-6.5-linux-x64-v2/libcudnn* /usr/local/cuda/lib64
+sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
```
##### Configure TensorFlow's canonical view of Cuda libraries
@@ -450,7 +451,7 @@ Configuration finished
##### Known issues
* Although it is possible to build both Cuda and non-Cuda configs under the same
-source tree, we recommend to run "bazel clean" when switching between these two
+source tree, we recommend to run `bazel clean` when switching between these two
configs in the same source tree.
* You have to run configure before running bazel build. Otherwise, the build
@@ -469,7 +470,7 @@ case, be sure to install its dependency [PCRE](from www.pcre.org) and not PCRE2.
#### Dependencies
Follow instructions [here](http://bazel.io/docs/install.html) to install the
-dependencies for Bazel. You can then use homebrew to install bazel and SWIG:
+dependencies for bazel. You can then use homebrew to install bazel and SWIG:
```bash
$ brew install bazel swig
@@ -506,6 +507,8 @@ Do you wish to build TensorFlow with GPU support? [y/N]
### Create the pip package and install
+When building from source, you will still build a pip package and install that.
+
```bash
$ bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
@@ -518,6 +521,29 @@ $ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
$ pip install /tmp/tensorflow_pkg/tensorflow-0.6.0-cp27-none-linux_x86_64.whl
```
+## Setting up TensorFlow for Development
+
+If you're working on TensorFlow itself, it is useful to be able to test your
+changes in an interactive python shell without having to reinstall TensorFlow.
+
+To set up TensorFlow such that all files are linked (instead of copied) from the
+system directories, run the following commands inside the TensorFlow root
+directory:
+
+```bash
+bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
+mkdir _python_build
+cd _python_build
+ln -s ../bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/* .
+ln -s ../tensorflow/tools/pip_package/* .
+python setup.py develop
+```
+
+Note that this setup still requires you to rebuild the
+`//tensorflow/tools/pip_package:build_pip_package` target every time you change
+a C++ file; add, delete, or move any python file; or if you change bazel build
+rules.
+
## Train your first TensorFlow neural net model
Starting from the root of your source tree, run:
@@ -546,29 +572,6 @@ Validation error: 7.0%
...
```
-## Setting up TensorFlow for Development
-
-If you're working on TensorFlow itself, it is useful to be able to test your
-changes in an interactive python shell without having to reinstall TensorFlow.
-
-To set up TensorFlow such that all files are linked (instead of copied) from the
-system directories, run the following commands inside the TensorFlow root
-directory:
-
-```bash
-bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
-mkdir _python_build
-cd _python_build
-ln -s ../bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/* .
-ln -s ../tensorflow/tools/pip_package/* .
-python setup.py develop
-```
-
-Note that this setup still requires you to rebuild the
-`//tensorflow/tools/pip_package:build_pip_package` target every time you change
-a C++ file; add, delete, or move any python file; or if you change bazel build
-rules.
-
## Common Problems
### GPU-related issues
@@ -579,7 +582,7 @@ If you encounter the following when trying to run a TensorFlow program:
ImportError: libcudart.so.7.0: cannot open shared object file: No such file or directory
```
-Make sure you followed the the GPU installation [instructions](#optional-install-cuda-gpus-on-linux).
+Make sure you followed the GPU installation [instructions](#optional-install-cuda-gpus-on-linux).
### Pip installation issues
diff --git a/tensorflow/g3doc/how_tos/reading_data/index.md b/tensorflow/g3doc/how_tos/reading_data/index.md
index f991f2b2ea..554cb854db 100644
--- a/tensorflow/g3doc/how_tos/reading_data/index.md
+++ b/tensorflow/g3doc/how_tos/reading_data/index.md
@@ -99,7 +99,7 @@ key, value = reader.read(filename_queue)
record_defaults = [[1], [1], [1], [1], [1]]
col1, col2, col3, col4, col5 = tf.decode_csv(
value, record_defaults=record_defaults)
-features = tf.concat(0, [col1, col2, col3, col4])
+features = tf.pack([col1, col2, col3, col4])
with tf.Session() as sess:
# Start populating the filename queue.
diff --git a/tensorflow/g3doc/how_tos/threading_and_queues/index.md b/tensorflow/g3doc/how_tos/threading_and_queues/index.md
index 68bb7626fa..c13ccc5e62 100644
--- a/tensorflow/g3doc/how_tos/threading_and_queues/index.md
+++ b/tensorflow/g3doc/how_tos/threading_and_queues/index.md
@@ -85,7 +85,7 @@ def MyLoop(coord):
coord = Coordinator()
# Create 10 threads that run 'MyLoop()'
-threads = [threading.Thread(target=MyLoop, args=(coord)) for i in xrange(10)]
+threads = [threading.Thread(target=MyLoop, args=(coord,)) for i in xrange(10)]
# Start the threads and wait for all of them to stop.
for t in threads: t.start()
diff --git a/tensorflow/g3doc/resources/dims_types.md b/tensorflow/g3doc/resources/dims_types.md
index c636f8a34a..18390724e3 100644
--- a/tensorflow/g3doc/resources/dims_types.md
+++ b/tensorflow/g3doc/resources/dims_types.md
@@ -40,7 +40,7 @@ Rank | Shape | Dimension number | Example
1 | [D0] | 1-D | A 1-D tensor with shape [5].
2 | [D0, D1] | 2-D | A 2-D tensor with shape [3, 4].
3 | [D0, D1, D2] | 3-D | A 3-D tensor with shape [1, 4, 3].
-n | [D0, D1, ... Dn] | n-D | A tensor with shape [D0, D1, ... Dn].
+n | [D0, D1, ... Dn-1] | n-D | A tensor with shape [D0, D1, ... Dn-1].
Shapes can be represented via Python lists / tuples of ints, or with the
[`TensorShape` class](../api_docs/python/framework.md#TensorShape).
@@ -64,4 +64,4 @@ Data type | Python type | Description
`DT_COMPLEX64` | `tf.complex64` | Complex number made of two 32 bits floating points: real and imaginary parts.
`DT_QINT8` | `tf.qint8` | 8 bits signed integer used in quantized Ops.
`DT_QINT32` | `tf.qint32` | 32 bits signed integer used in quantized Ops.
-`DT_QUINT8` | `tf.quint8` | 8 bits unsigned integer used in quantized Ops. \ No newline at end of file
+`DT_QUINT8` | `tf.quint8` | 8 bits unsigned integer used in quantized Ops.
diff --git a/tensorflow/g3doc/tutorials/mnist/tf/index.md b/tensorflow/g3doc/tutorials/mnist/tf/index.md
index 107712ee23..42c52e1cbd 100644
--- a/tensorflow/g3doc/tutorials/mnist/tf/index.md
+++ b/tensorflow/g3doc/tutorials/mnist/tf/index.md
@@ -390,7 +390,7 @@ summary_writer = tf.train.SummaryWriter(FLAGS.train_dir,
```
Lastly, the events file will be updated with new summary values every time the
-`summary_op` is run and the ouput passed to the writer's `add_summary()`
+`summary_op` is run and the output passed to the writer's `add_summary()`
function.
```python
diff --git a/tensorflow/g3doc/tutorials/recurrent/index.md b/tensorflow/g3doc/tutorials/recurrent/index.md
index f88a266542..82e369b80a 100644
--- a/tensorflow/g3doc/tutorials/recurrent/index.md
+++ b/tensorflow/g3doc/tutorials/recurrent/index.md
@@ -10,7 +10,7 @@ for an introduction to recurrent neural networks and LSTMs in particular.
In this tutorial we will show how to train a recurrent neural network on
a challenging task of language modeling. The goal of the problem is to fit a
-probabilistic model which assigns probablities to sentences. It does so by
+probabilistic model which assigns probabilities to sentences. It does so by
predicting next words in a text given a history of previous words. For this
purpose we will use the Penn Tree Bank (PTB) dataset, which is a popular
benchmark for measuring quality of these models, whilst being small and
@@ -80,7 +80,7 @@ of unrolled steps.
This is easy to implement by feeding inputs of length `num_steps` at a time and
doing backward pass after each iteration.
-A simplifed version of the code for the graph creation for truncated
+A simplified version of the code for the graph creation for truncated
backpropagation:
```python
@@ -129,7 +129,7 @@ word_embeddings = tf.nn.embedding_lookup(embedding_matrix, word_ids)
The embedding matrix will be initialized randomly and the model will learn to
differentiate the meaning of words just by looking at the data.
-### Loss Fuction
+### Loss Function
We want to minimize the average negative log probability of the target words:
diff --git a/tensorflow/g3doc/tutorials/seq2seq/index.md b/tensorflow/g3doc/tutorials/seq2seq/index.md
index e0a91c66b1..50101f9a0d 100644
--- a/tensorflow/g3doc/tutorials/seq2seq/index.md
+++ b/tensorflow/g3doc/tutorials/seq2seq/index.md
@@ -50,7 +50,7 @@ This basic architecture is depicted below.
Each box in the picture above represents a cell of the RNN, most commonly
a GRU cell or an LSTM cell (see the [RNN Tutorial](../../tutorials/recurrent/index.md)
for an explanation of those). Encoder and decoder can share weights or,
-as is more common, use a different set of parameters. Mutli-layer cells
+as is more common, use a different set of parameters. Multi-layer cells
have been successfully used in sequence-to-sequence models too, e.g. for
translation [Sutskever et al., 2014](http://arxiv.org/abs/1409.3215).
@@ -203,7 +203,7 @@ sentence with a special PAD symbol. Then we'd need only one seq2seq model,
for the padded lengths. But on shorter sentence our model would be inefficient,
encoding and decoding many PAD symbols that are useless.
-As a compromise between contructing a graph for every pair of lengths and
+As a compromise between constructing a graph for every pair of lengths and
padding to a single length, we use a number of *buckets* and pad each sentence
to the length of the bucket above it. In `translate.py` we use the following
default buckets.
diff --git a/tensorflow/models/embedding/word2vec_kernels.cc b/tensorflow/models/embedding/word2vec_kernels.cc
index d3be3ce678..42ac39d46e 100644
--- a/tensorflow/models/embedding/word2vec_kernels.cc
+++ b/tensorflow/models/embedding/word2vec_kernels.cc
@@ -133,7 +133,7 @@ class SkipgramOp : public OpKernel {
int32 label_limit_ GUARDED_BY(mu_);
// {example_pos_, label_pos_} is the cursor for the next example.
- // example_pos_ wrapps around at the end of corpus_. For each
+ // example_pos_ wraps around at the end of corpus_. For each
// example, we randomly generate [label_pos_, label_limit) for
// labels.
void NextExample(int32* example, int32* label) EXCLUSIVE_LOCKS_REQUIRED(mu_) {
diff --git a/tensorflow/models/embedding/word2vec_ops.cc b/tensorflow/models/embedding/word2vec_ops.cc
index af765e7f04..1c16da6fda 100644
--- a/tensorflow/models/embedding/word2vec_ops.cc
+++ b/tensorflow/models/embedding/word2vec_ops.cc
@@ -65,7 +65,7 @@ w_out: output word embedding.
examples: A vector of word ids.
labels: A vector of word ids.
vocab_count: Count of words in the vocabulary.
-num_negative_samples: Number of negative samples per exaple.
+num_negative_samples: Number of negative samples per example.
)doc");
} // end namespace tensorflow
diff --git a/tensorflow/models/image/alexnet/alexnet_benchmark.py b/tensorflow/models/image/alexnet/alexnet_benchmark.py
index d70f213708..0baedcc9e9 100644
--- a/tensorflow/models/image/alexnet/alexnet_benchmark.py
+++ b/tensorflow/models/image/alexnet/alexnet_benchmark.py
@@ -164,7 +164,7 @@ def time_tensorflow_run(session, target, info_string):
Args:
session: the TensorFlow session to run the computation under.
- target: the targe Tensor that is passed to the session's run() function.
+ target: the target Tensor that is passed to the session's run() function.
info_string: a string summarizing this run, to be printed with the stats.
Returns:
diff --git a/tensorflow/models/image/cifar10/cifar10.py b/tensorflow/models/image/cifar10/cifar10.py
index 32234db496..ef89becf52 100644
--- a/tensorflow/models/image/cifar10/cifar10.py
+++ b/tensorflow/models/image/cifar10/cifar10.py
@@ -230,7 +230,7 @@ def inference(images):
weights = _variable_with_weight_decay('weights', shape=[dim, 384],
stddev=0.04, wd=0.004)
biases = _variable_on_cpu('biases', [384], tf.constant_initializer(0.1))
- local3 = tf.nn.relu_layer(reshape, weights, biases, name=scope.name)
+ local3 = tf.nn.relu(tf.matmul(reshape, weights) + biases, name=scope.name)
_activation_summary(local3)
# local4
@@ -238,7 +238,7 @@ def inference(images):
weights = _variable_with_weight_decay('weights', shape=[384, 192],
stddev=0.04, wd=0.004)
biases = _variable_on_cpu('biases', [192], tf.constant_initializer(0.1))
- local4 = tf.nn.relu_layer(local3, weights, biases, name=scope.name)
+ local4 = tf.nn.relu(tf.matmul(local3, weights) + biases, name=scope.name)
_activation_summary(local4)
# softmax, i.e. softmax(WX + b)
@@ -247,7 +247,7 @@ def inference(images):
stddev=1/192.0, wd=0.0)
biases = _variable_on_cpu('biases', [NUM_CLASSES],
tf.constant_initializer(0.0))
- softmax_linear = tf.nn.xw_plus_b(local4, weights, biases, name=scope.name)
+ softmax_linear = tf.add(tf.matmul(local4, weights), biases, name=scope.name)
_activation_summary(softmax_linear)
return softmax_linear
@@ -301,7 +301,7 @@ def _add_loss_summaries(total_loss):
losses = tf.get_collection('losses')
loss_averages_op = loss_averages.apply(losses + [total_loss])
- # Attach a scalar summmary to all individual losses and the total loss; do the
+ # Attach a scalar summary to all individual losses and the total loss; do the
# same for the averaged version of the losses.
for l in losses + [total_loss]:
# Name each loss as '(raw)' and name the moving average version of the loss
@@ -384,5 +384,5 @@ def maybe_download_and_extract():
reporthook=_progress)
print()
statinfo = os.stat(filepath)
- print('Succesfully downloaded', filename, statinfo.st_size, 'bytes.')
+ print('Successfully downloaded', filename, statinfo.st_size, 'bytes.')
tarfile.open(filepath, 'r:gz').extractall(dest_directory)
diff --git a/tensorflow/models/image/cifar10/cifar10_multi_gpu_train.py b/tensorflow/models/image/cifar10/cifar10_multi_gpu_train.py
index 9ba4730b31..f594b86627 100644
--- a/tensorflow/models/image/cifar10/cifar10_multi_gpu_train.py
+++ b/tensorflow/models/image/cifar10/cifar10_multi_gpu_train.py
@@ -95,7 +95,7 @@ def tower_loss(scope):
loss_averages = tf.train.ExponentialMovingAverage(0.9, name='avg')
loss_averages_op = loss_averages.apply(losses + [total_loss])
- # Attach a scalar summmary to all individual losses and the total loss; do the
+ # Attach a scalar summary to all individual losses and the total loss; do the
# same for the averaged version of the losses.
for l in losses + [total_loss]:
# Remove 'tower_[0-9]/' from the name in case this is a multi-GPU training
diff --git a/tensorflow/models/rnn/ptb/ptb_word_lm.py b/tensorflow/models/rnn/ptb/ptb_word_lm.py
index 41b67d8b24..78890a4a3e 100644
--- a/tensorflow/models/rnn/ptb/ptb_word_lm.py
+++ b/tensorflow/models/rnn/ptb/ptb_word_lm.py
@@ -129,9 +129,9 @@ class PTBModel(object):
states.append(state)
output = tf.reshape(tf.concat(1, outputs), [-1, size])
- logits = tf.nn.xw_plus_b(output,
- tf.get_variable("softmax_w", [size, vocab_size]),
- tf.get_variable("softmax_b", [vocab_size]))
+ softmax_w = tf.get_variable("softmax_w", [size, vocab_size])
+ softmax_b = tf.get_variable("softmax_b", [vocab_size])
+ logits = tf.matmul(output, softmax_w) + softmax_b
loss = seq2seq.sequence_loss_by_example([logits],
[tf.reshape(self._targets, [-1])],
[tf.ones([batch_size * num_steps])],
diff --git a/tensorflow/models/rnn/ptb/reader.py b/tensorflow/models/rnn/ptb/reader.py
index cab3b6a687..1f4af1c45f 100644
--- a/tensorflow/models/rnn/ptb/reader.py
+++ b/tensorflow/models/rnn/ptb/reader.py
@@ -43,8 +43,7 @@ def _build_vocab(filename):
data = _read_words(filename)
counter = collections.Counter(data)
- count_pairs = sorted(counter.items(),
- key=lambda (word, count): (-count, word))
+ count_pairs = sorted(counter.items(), key=lambda x: (-x[1], x[0]))
words, _ = list(zip(*count_pairs))
word_to_id = dict(zip(words, range(len(words))))
diff --git a/tensorflow/models/rnn/translate/data_utils.py b/tensorflow/models/rnn/translate/data_utils.py
index 250762adc5..0b81c16a44 100644
--- a/tensorflow/models/rnn/translate/data_utils.py
+++ b/tensorflow/models/rnn/translate/data_utils.py
@@ -255,7 +255,7 @@ def prepare_wmt_data(data_dir, en_vocabulary_size, fr_vocabulary_size):
(3) path to the token-ids for English development data-set,
(4) path to the token-ids for French development data-set,
(5) path to the English vocabulary file,
- (6) path to the French vocabluary file.
+ (6) path to the French vocabulary file.
"""
# Get wmt data to the specified directory.
train_path = get_wmt_enfr_train_set(data_dir)
diff --git a/tensorflow/models/rnn/translate/seq2seq_model.py b/tensorflow/models/rnn/translate/seq2seq_model.py
index 1405fcac83..49adbb415f 100644
--- a/tensorflow/models/rnn/translate/seq2seq_model.py
+++ b/tensorflow/models/rnn/translate/seq2seq_model.py
@@ -141,9 +141,10 @@ class Seq2SeqModel(object):
# If we use output projection, we need to project outputs for decoding.
if output_projection is not None:
for b in xrange(len(buckets)):
- self.outputs[b] = [tf.nn.xw_plus_b(output, output_projection[0],
- output_projection[1])
- for output in self.outputs[b]]
+ self.outputs[b] = [
+ tf.matmul(output, output_projection[0]) + output_projection[1]
+ for output in self.outputs[b]
+ ]
else:
self.outputs, self.losses = seq2seq.model_with_buckets(
self.encoder_inputs, self.decoder_inputs, targets,
@@ -184,7 +185,7 @@ class Seq2SeqModel(object):
average perplexity, and the outputs.
Raises:
- ValueError: if length of enconder_inputs, decoder_inputs, or
+ ValueError: if length of encoder_inputs, decoder_inputs, or
target_weights disagrees with bucket size for the specified bucket_id.
"""
# Check if the sizes match.
diff --git a/tensorflow/python/client/session.py b/tensorflow/python/client/session.py
index c629e7e34a..918e7e4da6 100644
--- a/tensorflow/python/client/session.py
+++ b/tensorflow/python/client/session.py
@@ -53,6 +53,17 @@ class SessionInterface(object):
raise NotImplementedError('Run')
+def _get_indexed_slices_value_from_fetches(fetched_vals):
+ return ops.IndexedSlicesValue(fetched_vals[0], fetched_vals[1],
+ fetched_vals[2]
+ if len(fetched_vals) == 3 else None)
+
+
+def _get_feeds_for_indexed_slices(feed, feed_val):
+ return list(zip([feed.values, feed.indices] if feed.dense_shape is None else
+ [feed.values, feed.indices, feed.dense_shape], feed_val))
+
+
class BaseSession(SessionInterface):
"""A class for interacting with a TensorFlow computation.
@@ -221,6 +232,14 @@ class BaseSession(SessionInterface):
lambda fetched_vals: ops.SparseTensorValue(*fetched_vals)),
lambda feed, feed_val: list(zip(
[feed.indices, feed.values, feed.shape], feed_val))),
+ # IndexedSlices are fetched as IndexedSlicesValues. They can be fed
+ # IndexedSlicesValues or normal tuples.
+ (ops.IndexedSlices,
+ lambda fetch: (
+ [fetch.values, fetch.indices] if fetch.dense_shape is None
+ else [fetch.values, fetch.indices, fetch.dense_shape],
+ _get_indexed_slices_value_from_fetches),
+ _get_feeds_for_indexed_slices),
# The default catches all types and performs no expansions.
(object,
lambda fetch: ([fetch], lambda fetched_vals: fetched_vals[0]),
diff --git a/tensorflow/python/client/session_test.py b/tensorflow/python/client/session_test.py
index a1a9c57b1c..8073b76b3f 100644
--- a/tensorflow/python/client/session_test.py
+++ b/tensorflow/python/client/session_test.py
@@ -248,6 +248,144 @@ class SessionTest(test_util.TensorFlowTestCase):
self.assertAllEqual(sp2_out.values, values)
self.assertAllEqual(sp2_out.shape, shape)
+ def testFetchIndexedSlices(self):
+ with session.Session() as s:
+ indices = np.array([[3, 2, 0], [4, 5, 1]]).astype(np.int64)
+ values = np.array([1.0, 2.0]).astype(np.float32)
+ dense_shape = np.array([7, 9, 2]).astype(np.int64)
+ ind = ops.IndexedSlices(
+ constant_op.constant(values), constant_op.constant(indices),
+ constant_op.constant(dense_shape))
+ # Single fetch, use as tuple
+ ind_out = s.run(ind)
+ values_out, indices_out, dense_shape_out = ind_out
+ self.assertAllEqual(values_out, values)
+ self.assertAllEqual(indices_out, indices)
+ self.assertAllEqual(dense_shape_out, dense_shape)
+ # Single fetch, use as IndexedSlicesValue
+ ind_out = s.run(ind)
+ self.assertAllEqual(ind_out.values, values)
+ self.assertAllEqual(ind_out.indices, indices)
+ self.assertAllEqual(ind_out.dense_shape, dense_shape)
+ # Tuple fetch, use as tuple
+ values_out, indices_out, dense_shape_out = s.run(ind)
+ self.assertAllEqual(values_out, values)
+ self.assertAllEqual(indices_out, indices)
+ self.assertAllEqual(dense_shape_out, dense_shape)
+ # List fetch, use as tuple
+ (values_out, indices_out, dense_shape_out), = s.run([ind])
+ self.assertAllEqual(values_out, values)
+ self.assertAllEqual(indices_out, indices)
+ self.assertAllEqual(dense_shape_out, dense_shape)
+ # List fetch, use as IndexedSlicesValue
+ ind_out, = s.run([ind])
+ self.assertAllEqual(ind_out.values, values)
+ self.assertAllEqual(ind_out.indices, indices)
+ self.assertAllEqual(ind_out.dense_shape, dense_shape)
+
+ def testFeedIndexedSlices(self):
+ with session.Session() as s:
+ values = np.array([1.0, 2.0]).astype(np.float32)
+ indices = np.array([[3, 2, 0], [4, 5, 1]]).astype(np.int64)
+ dense_shape = np.array([7, 9, 2]).astype(np.int64)
+ ind = ops.IndexedSlices(
+ array_ops.placeholder(dtype=np.float32,
+ shape=(2,)),
+ array_ops.placeholder(dtype=np.int64,
+ shape=(2, 3)),
+ array_ops.placeholder(dtype=np.int64,
+ shape=(3,)),)
+ ind_values = array_ops.identity(ind.values)
+ ind_indices = array_ops.identity(ind.indices)
+ ind_dense_shape = array_ops.identity(ind.dense_shape)
+ ind2 = ops.IndexedSlices(ind_values, ind_indices, ind_dense_shape)
+ # Feed with tuple
+ values_out, indices_out, dense_shape_out = s.run(
+ [ind_values, ind_indices, ind_dense_shape],
+ {ind: (values, indices, dense_shape)})
+ self.assertAllEqual(values_out, values)
+ self.assertAllEqual(indices_out, indices)
+ self.assertAllEqual(dense_shape_out, dense_shape)
+ # Feed with IndexedSlicesValue
+ values_out, indices_out, dense_shape_out = s.run(
+ [ind_values, ind_indices, ind_dense_shape],
+ {ind: ops.IndexedSlicesValue(values, indices, dense_shape)})
+ self.assertAllEqual(values_out, values)
+ self.assertAllEqual(indices_out, indices)
+ self.assertAllEqual(dense_shape_out, dense_shape)
+ # Feed with IndexedSlicesValue, fetch IndexedSlicesValue
+ ind2_out = s.run(ind2, {ind: ops.IndexedSlicesValue(values, indices,
+ dense_shape)})
+ self.assertAllEqual(ind2_out.values, values)
+ self.assertAllEqual(ind2_out.indices, indices)
+ self.assertAllEqual(ind2_out.dense_shape, dense_shape)
+
+ def testFetchIndexedSlicesWithoutDenseShape(self):
+ with session.Session() as s:
+ indices = np.array([[3, 2, 0], [4, 5, 1]]).astype(np.int64)
+ values = np.array([1.0, 2.0]).astype(np.float32)
+ dense_shape = None
+ ind = ops.IndexedSlices(
+ constant_op.constant(values), constant_op.constant(indices), None)
+ # Single fetch, use as tuple
+ ind_out = s.run(ind)
+ values_out, indices_out, dense_shape_out = ind_out
+ self.assertAllEqual(values_out, values)
+ self.assertAllEqual(indices_out, indices)
+ self.assertAllEqual(dense_shape_out, dense_shape)
+ # Single fetch, use as IndexedSlicesValue
+ ind_out = s.run(ind)
+ self.assertAllEqual(ind_out.values, values)
+ self.assertAllEqual(ind_out.indices, indices)
+ self.assertAllEqual(ind_out.dense_shape, dense_shape)
+ # Tuple fetch, use as tuple
+ values_out, indices_out, dense_shape_out = s.run(ind)
+ self.assertAllEqual(values_out, values)
+ self.assertAllEqual(indices_out, indices)
+ self.assertAllEqual(dense_shape_out, dense_shape)
+ # List fetch, use as tuple
+ (values_out, indices_out, dense_shape_out), = s.run([ind])
+ self.assertAllEqual(values_out, values)
+ self.assertAllEqual(indices_out, indices)
+ self.assertAllEqual(dense_shape_out, dense_shape)
+ # List fetch, use as IndexedSlicesValue
+ ind_out, = s.run([ind])
+ self.assertAllEqual(ind_out.values, values)
+ self.assertAllEqual(ind_out.indices, indices)
+ self.assertAllEqual(ind_out.dense_shape, dense_shape)
+
+ def testFeedIndexedSlicesWithoutDenseShape(self):
+ with session.Session() as s:
+ values = np.array([1.0, 2.0]).astype(np.float32)
+ indices = np.array([[3, 2, 0], [4, 5, 1]]).astype(np.int64)
+ dense_shape = None
+ ind = ops.IndexedSlices(
+ array_ops.placeholder(dtype=np.float32,
+ shape=(2,)),
+ array_ops.placeholder(dtype=np.int64,
+ shape=(2, 3)),
+ None)
+ ind_values = array_ops.identity(ind.values)
+ ind_indices = array_ops.identity(ind.indices)
+ ind2 = ops.IndexedSlices(ind_values, ind_indices)
+ # Feed with tuple
+ values_out, indices_out = s.run(
+ [ind_values, ind_indices], {ind: (values, indices)})
+ self.assertAllEqual(values_out, values)
+ self.assertAllEqual(indices_out, indices)
+ # Feed with IndexedSlicesValue
+ values_out, indices_out = s.run(
+ [ind_values, ind_indices],
+ {ind: ops.IndexedSlicesValue(values, indices, dense_shape)})
+ self.assertAllEqual(values_out, values)
+ self.assertAllEqual(indices_out, indices)
+ # Feed with IndexedSlicesValue, fetch IndexedSlicesValue
+ ind2_out = s.run(ind2, {ind: ops.IndexedSlicesValue(values, indices,
+ dense_shape)})
+ self.assertAllEqual(ind2_out.values, values)
+ self.assertAllEqual(ind2_out.indices, indices)
+ self.assertAllEqual(ind2_out.dense_shape, dense_shape)
+
def testExtendWithStatelessOperations(self):
with session.Session() as s:
a = constant_op.constant(1.0, shape=[1, 2])
diff --git a/tensorflow/python/client/tf_session.i b/tensorflow/python/client/tf_session.i
index 3b86029a23..3618233327 100644
--- a/tensorflow/python/client/tf_session.i
+++ b/tensorflow/python/client/tf_session.i
@@ -204,7 +204,11 @@ tensorflow::ImportNumpy();
// The wrapped function TF_GetOpList returns a TF_Buffer pointer. This typemap
// creates a Python string from the TF_Buffer and returns it.
%typemap(out) TF_Buffer TF_GetOpList {
+%#if PY_MAJOR_VERSION < 3
$result = PyString_FromStringAndSize(
+%#else
+ $result = PyUnicode_FromStringAndSize(
+%#endif
reinterpret_cast<const char*>($1.data), $1.length);
}
diff --git a/tensorflow/python/framework/docs.py b/tensorflow/python/framework/docs.py
index 38e72deb30..9f953605e5 100644
--- a/tensorflow/python/framework/docs.py
+++ b/tensorflow/python/framework/docs.py
@@ -121,7 +121,7 @@ def collect_members(module_to_name):
if len(fullname) == len(other_fullname):
raise RuntimeError("Can't decide whether to use %s or %s for %s: "
"both full names have length %d" %
- (fullname, other_fullname, len(fullname)))
+ (fullname, other_fullname, name, len(fullname)))
if len(fullname) > len(other_fullname):
continue # Use the shorter full name
members[name] = fullname, member
diff --git a/tensorflow/python/framework/ops.py b/tensorflow/python/framework/ops.py
index f889e2b3f8..d91aef2a27 100644
--- a/tensorflow/python/framework/ops.py
+++ b/tensorflow/python/framework/ops.py
@@ -143,7 +143,7 @@ class Tensor(object):
d = tf.constant([[1.0, 1.0], [0.0, 1.0]])
e = tf.matmul(c, d)
- # Construct a `Session` to execut the graph.
+ # Construct a `Session` to execute the graph.
sess = tf.Session()
# Execute the graph and store the value that `e` represents in `result`.
@@ -784,6 +784,10 @@ class IndexedSlices(object):
(", dense_shape=%s" % self._dense_shape) if self._dense_shape else "")
+IndexedSlicesValue = collections.namedtuple(
+ "IndexedSlicesValue", ["values", "indices", "dense_shape"])
+
+
class SparseTensor(object):
"""Represents a sparse tensor.
diff --git a/tensorflow/python/kernel_tests/control_flow_ops_py_test.py b/tensorflow/python/kernel_tests/control_flow_ops_py_test.py
index ebb20e0cc0..c315959572 100644
--- a/tensorflow/python/kernel_tests/control_flow_ops_py_test.py
+++ b/tensorflow/python/kernel_tests/control_flow_ops_py_test.py
@@ -1427,26 +1427,49 @@ class ControlFlowTest(tf.test.TestCase):
self.assertIs(None, m.get_shape().ndims)
self.assertEqual([], index.get_shape())
- # All inputs known but different.
+ # All inputs known with different ranks.
p1 = tf.placeholder(tf.float32, shape=[1, 2])
- p2 = tf.placeholder(tf.float32, shape=[2, 1])
+ p2 = tf.placeholder(tf.float32, shape=[1, 2, 3])
m, index = control_flow_ops.merge([p1, p2])
self.assertIs(None, m.get_shape().ndims)
self.assertEqual([], index.get_shape())
- # All inputs known but same.
+ # All inputs known with some dimensions different.
p1 = tf.placeholder(tf.float32, shape=[1, 2])
- p2 = tf.placeholder(tf.float32, shape=[1, 2])
+ p2 = tf.placeholder(tf.float32, shape=[2, 1])
m, index = control_flow_ops.merge([p1, p2])
- self.assertEqual([1, 2], m.get_shape())
+ self.assertEqual([None, None], m.get_shape().as_list())
self.assertEqual([], index.get_shape())
- # Possibly the same but not guaranteed.
p1 = tf.placeholder(tf.float32, shape=[1, 2])
- p2 = tf.placeholder(tf.float32)
- p2.set_shape([None, 2])
+ p2 = tf.placeholder(tf.float32, shape=[None, 2])
m, index = control_flow_ops.merge([p1, p2])
- self.assertIs(None, m.get_shape().ndims)
+ self.assertEqual([None, 2], m.get_shape().as_list())
+ self.assertEqual([], index.get_shape())
+
+ p1 = tf.placeholder(tf.float32, shape=[1, 2])
+ p2 = tf.placeholder(tf.float32, shape=[2, 2])
+ m, index = control_flow_ops.merge([p1, p2])
+ self.assertEqual([None, 2], m.get_shape().as_list())
+ self.assertEqual([], index.get_shape())
+
+ # All inputs known with same dimensions.
+ p1 = tf.placeholder(tf.float32, shape=[1, 2])
+ p2 = tf.placeholder(tf.float32, shape=[1, 2])
+ m, index = control_flow_ops.merge([p1, p2])
+ self.assertEqual([1, 2], m.get_shape().as_list())
+ self.assertEqual([], index.get_shape())
+
+ p1 = tf.placeholder(tf.float32, shape=[None, 2])
+ p2 = tf.placeholder(tf.float32, shape=[None, 2])
+ m, index = control_flow_ops.merge([p1, p2])
+ self.assertEqual([None, 2], m.get_shape().as_list())
+ self.assertEqual([], index.get_shape())
+
+ p1 = tf.placeholder(tf.float32, shape=[None, None])
+ p2 = tf.placeholder(tf.float32, shape=[None, None])
+ m, index = control_flow_ops.merge([p1, p2])
+ self.assertEqual([None, None], m.get_shape().as_list())
self.assertEqual([], index.get_shape())
def testRefSelect(self):
diff --git a/tensorflow/python/kernel_tests/cwise_ops_test.py b/tensorflow/python/kernel_tests/cwise_ops_test.py
index 8bd73b8ac2..8eb6ac8c5f 100644
--- a/tensorflow/python/kernel_tests/cwise_ops_test.py
+++ b/tensorflow/python/kernel_tests/cwise_ops_test.py
@@ -106,7 +106,7 @@ class UnaryOpTest(tf.test.TestCase):
def func(x):
try:
return fn(x)
- except ValueError, e:
+ except ValueError as e:
if "domain error" in e.message:
return np.inf * np.ones_like(x)
else:
diff --git a/tensorflow/python/kernel_tests/rnn_test.py b/tensorflow/python/kernel_tests/rnn_test.py
index 29431891b3..a8724fcd34 100644
--- a/tensorflow/python/kernel_tests/rnn_test.py
+++ b/tensorflow/python/kernel_tests/rnn_test.py
@@ -37,7 +37,7 @@ class Plus1RNNCell(tf.nn.rnn_cell.RNNCell):
def state_size(self):
return 5
- def __call__(self, input_, state):
+ def __call__(self, input_, state, scope=None):
return (input_ + 1, state + 1)
@@ -516,30 +516,47 @@ class BidirectionalRNNTest(tf.test.TestCase):
self._seed = 23489
np.random.seed(self._seed)
- def _testBidirectionalRNN(self, use_gpu):
+ def _createBidirectionalRNN(self, use_gpu, use_shape, use_sequence_length):
num_units = 3
input_size = 5
batch_size = 2
max_length = 8
- with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
- initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
- sequence_length = tf.placeholder(tf.int64)
- cell_fw = tf.nn.rnn_cell.LSTMCell(
- num_units, input_size, initializer=initializer)
- cell_bw = tf.nn.rnn_cell.LSTMCell(
- num_units, input_size, initializer=initializer)
- inputs = max_length * [
- tf.placeholder(tf.float32, shape=(batch_size, input_size))]
- outputs = tf.nn.bidirectional_rnn(
- cell_fw, cell_bw, inputs, dtype=tf.float32,
- sequence_length=sequence_length)
- self.assertEqual(len(outputs), len(inputs))
- for out in outputs:
- self.assertEqual(out.get_shape().as_list(), [batch_size, 2 * num_units])
+ initializer = tf.random_uniform_initializer(-0.01, 0.01, seed=self._seed)
+ sequence_length = tf.placeholder(tf.int64) if use_sequence_length else None
+ cell_fw = tf.nn.rnn_cell.LSTMCell(num_units,
+ input_size,
+ initializer=initializer)
+ cell_bw = tf.nn.rnn_cell.LSTMCell(num_units,
+ input_size,
+ initializer=initializer)
+ inputs = max_length * [
+ tf.placeholder(tf.float32,
+ shape=(batch_size, input_size) if use_shape else None)
+ ]
+ outputs = tf.nn.bidirectional_rnn(cell_fw,
+ cell_bw,
+ inputs,
+ dtype=tf.float32,
+ sequence_length=sequence_length)
+ self.assertEqual(len(outputs), len(inputs))
+ for out in outputs:
+ if use_sequence_length:
+ # Merging with the zero state makes the dimensions None.
+ self.assertEqual(out.get_shape().as_list(), [None, None])
+ else:
+ self.assertEqual(out.get_shape().as_list(), [batch_size if use_shape
+ else None, 2 * num_units])
+ input_value = np.random.randn(batch_size, input_size)
+
+ return input_value, inputs, outputs, sequence_length
+
+ def _testBidirectionalRNN(self, use_gpu, use_shape):
+ with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
+ input_value, inputs, outputs, sequence_length = (
+ self._createBidirectionalRNN(use_gpu, use_shape, True))
tf.initialize_all_variables().run()
- input_value = np.random.randn(batch_size, input_size)
# Run with pre-specified sequence length of 2, 3
out = sess.run(outputs, feed_dict={inputs[0]: input_value,
sequence_length: [2, 3]})
@@ -575,10 +592,46 @@ class BidirectionalRNNTest(tf.test.TestCase):
self.assertEqual(out[2][1][1], out[0][1][4])
self.assertEqual(out[2][1][2], out[0][1][5])
- def testBidirectionalRNN(self):
- self._testBidirectionalRNN(use_gpu=False)
- self._testBidirectionalRNN(use_gpu=True)
+ def _testBidirectionalRNNWithoutSequenceLength(self, use_gpu, use_shape):
+ with self.test_session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
+ input_value, inputs, outputs, _ = self._createBidirectionalRNN(
+ use_gpu, use_shape, False)
+ tf.initialize_all_variables().run()
+ out = sess.run(outputs, feed_dict={inputs[0]: input_value})
+ # Since the forward and backward LSTM cells were initialized with the
+ # same parameters, the forward and backward output has to be the same,
+ # but reversed in time. The format is output[time][batch][depth], and
+ # due to depth concatenation (as num_units=3 for both RNNs):
+ # - forward output: out[][][depth] for 0 <= depth < 3
+ # - backward output: out[][][depth] for 4 <= depth < 6
+ #
+ # Both sequences in batch are length=8. Check that the time=i
+ # forward output is equal to time=8-1-i backward output
+ for i in xrange(8):
+ self.assertEqual(out[i][0][0], out[8 - 1 - i][0][3])
+ self.assertEqual(out[i][0][1], out[8 - 1 - i][0][4])
+ self.assertEqual(out[i][0][2], out[8 - 1 - i][0][5])
+ for i in xrange(8):
+ self.assertEqual(out[i][1][0], out[8 - 1 - i][1][3])
+ self.assertEqual(out[i][1][1], out[8 - 1 - i][1][4])
+ self.assertEqual(out[i][1][2], out[8 - 1 - i][1][5])
+
+ def testBidirectionalRNN(self):
+ self._testBidirectionalRNN(use_gpu=False, use_shape=False)
+ self._testBidirectionalRNN(use_gpu=True, use_shape=False)
+ self._testBidirectionalRNN(use_gpu=False, use_shape=True)
+ self._testBidirectionalRNN(use_gpu=True, use_shape=True)
+
+ def testBidirectionalRNNWithoutSequenceLength(self):
+ self._testBidirectionalRNNWithoutSequenceLength(use_gpu=False,
+ use_shape=False)
+ self._testBidirectionalRNNWithoutSequenceLength(use_gpu=True,
+ use_shape=False)
+ self._testBidirectionalRNNWithoutSequenceLength(use_gpu=False,
+ use_shape=True)
+ self._testBidirectionalRNNWithoutSequenceLength(use_gpu=True,
+ use_shape=True)
if __name__ == "__main__":
tf.test.main()
diff --git a/tensorflow/python/lib/core/py_func.cc b/tensorflow/python/lib/core/py_func.cc
index 3ed1e21c76..206fb4a83f 100644
--- a/tensorflow/python/lib/core/py_func.cc
+++ b/tensorflow/python/lib/core/py_func.cc
@@ -24,6 +24,14 @@ limitations under the License.
#include "tensorflow/core/platform/mutex.h"
#include "tensorflow/core/platform/port.h"
+// Return type of import_array() changed between Python 2 and 3
+// NUMPY_IMPORT_ARRAY_RETVAL is NULL for Python 3
+#if PY_MAJOR_VERSION >= 3
+#define NUMPY_IMPORT_ARRAY_RETURN_TYPE int
+#else
+#define NUMPY_IMPORT_ARRAY_RETURN_TYPE void
+#endif
+
namespace tensorflow {
namespace {
@@ -39,7 +47,7 @@ PyObject* GetPyTrampoline() {
}
// Module initialization (mainly import numpy) if needed.
-void InitIfNeeded() {
+NUMPY_IMPORT_ARRAY_RETURN_TYPE InitIfNeeded() {
mutex_lock l(mu);
if (!initialized) {
PyGILState_STATE py_threadstate;
diff --git a/tensorflow/python/ops/candidate_sampling_ops.py b/tensorflow/python/ops/candidate_sampling_ops.py
index 0af257ef08..245d46b266 100644
--- a/tensorflow/python/ops/candidate_sampling_ops.py
+++ b/tensorflow/python/ops/candidate_sampling_ops.py
@@ -192,10 +192,19 @@ def learned_unigram_candidate_sampler(true_classes, num_true, num_sampled,
seed2=seed2, name=name)
-def fixed_unigram_candidate_sampler(true_classes, num_true, num_sampled, unique,
- range_max, vocab_file='', distortion=1.0,
- num_reserved_ids=0, num_shards=1, shard=0,
- unigrams=[], seed=None, name=None):
+def fixed_unigram_candidate_sampler(true_classes,
+ num_true,
+ num_sampled,
+ unique,
+ range_max,
+ vocab_file='',
+ distortion=1.0,
+ num_reserved_ids=0,
+ num_shards=1,
+ shard=0,
+ unigrams=(),
+ seed=None,
+ name=None):
"""Samples a set of classes using the provided (fixed) base distribution.
This operation randomly samples a tensor of sampled classes
diff --git a/tensorflow/python/ops/control_flow_ops.py b/tensorflow/python/ops/control_flow_ops.py
index 6ab6125a3d..d9caa55d5a 100644
--- a/tensorflow/python/ops/control_flow_ops.py
+++ b/tensorflow/python/ops/control_flow_ops.py
@@ -1908,9 +1908,10 @@ def _MergeShape(op):
first output that is one of those inputs, and a second scalar
output.
- This function conservatively assumes that if any of its inputs is
- not fully defined, the output shape is unknown. If all of the inputs
- have the exact same known shape, the output must have that shape.
+ If all input shapes are known and have the same rank, the output
+ shape must have that rank, otherwise the output shape is unknown.
+ Each output dimension is specified only if that dimension in all
+ inputs are the same.
Args:
op: A Merge Operation.
@@ -1919,16 +1920,20 @@ def _MergeShape(op):
A single-element list containing the Shape of the Merge op.
"""
- first_input_shape = op.inputs[0].get_shape()
- if first_input_shape.is_fully_defined():
+ output_shape = op.inputs[0].get_shape()
+ if output_shape.dims is None:
+ return [tensor_shape.unknown_shape(), tensor_shape.scalar()]
+ else:
for input_ in op.inputs[1:]:
input_shape = input_.get_shape()
- if (not input_shape.is_fully_defined()
- or not input_shape.is_compatible_with(first_input_shape)):
+ if input_shape.dims is None or input_shape.ndims != output_shape.ndims:
return [tensor_shape.unknown_shape(), tensor_shape.scalar()]
- return [first_input_shape, tensor_shape.scalar()]
- else:
- return [tensor_shape.unknown_shape(), tensor_shape.scalar()]
+ else:
+ output_shape = tensor_shape.TensorShape(
+ [input_dim.value if input_dim.value == output_dim.value else None
+ for input_dim, output_dim in zip(input_shape.dims,
+ output_shape.dims)])
+ return [output_shape, tensor_shape.scalar()]
ops.RegisterShape("RefMerge")(_MergeShape)
diff --git a/tensorflow/python/ops/math_ops.py b/tensorflow/python/ops/math_ops.py
index f049f00d22..b6f8b01c53 100644
--- a/tensorflow/python/ops/math_ops.py
+++ b/tensorflow/python/ops/math_ops.py
@@ -655,7 +655,7 @@ def reduce_sum(input_tensor, reduction_indices=None, keep_dims=False,
Args:
input_tensor: The tensor to reduce. Should have numeric type.
- reduction_indices: The dimensions to reduce. If `None` (the defaut),
+ reduction_indices: The dimensions to reduce. If `None` (the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
@@ -692,7 +692,7 @@ def reduce_mean(input_tensor, reduction_indices=None, keep_dims=False,
Args:
input_tensor: The tensor to reduce. Should have numeric type.
- reduction_indices: The dimensions to reduce. If `None` (the defaut),
+ reduction_indices: The dimensions to reduce. If `None` (the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
@@ -719,7 +719,7 @@ def reduce_prod(input_tensor, reduction_indices=None, keep_dims=False,
Args:
input_tensor: The tensor to reduce. Should have numeric type.
- reduction_indices: The dimensions to reduce. If `None` (the defaut),
+ reduction_indices: The dimensions to reduce. If `None` (the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
@@ -746,7 +746,7 @@ def reduce_min(input_tensor, reduction_indices=None, keep_dims=False,
Args:
input_tensor: The tensor to reduce. Should have numeric type.
- reduction_indices: The dimensions to reduce. If `None` (the defaut),
+ reduction_indices: The dimensions to reduce. If `None` (the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
@@ -773,7 +773,7 @@ def reduce_max(input_tensor, reduction_indices=None, keep_dims=False,
Args:
input_tensor: The tensor to reduce. Should have numeric type.
- reduction_indices: The dimensions to reduce. If `None` (the defaut),
+ reduction_indices: The dimensions to reduce. If `None` (the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
@@ -810,7 +810,7 @@ def reduce_all(input_tensor, reduction_indices=None, keep_dims=False,
Args:
input_tensor: The boolean tensor to reduce.
- reduction_indices: The dimensions to reduce. If `None` (the defaut),
+ reduction_indices: The dimensions to reduce. If `None` (the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
@@ -847,7 +847,7 @@ def reduce_any(input_tensor, reduction_indices=None, keep_dims=False,
Args:
input_tensor: The boolean tensor to reduce.
- reduction_indices: The dimensions to reduce. If `None` (the defaut),
+ reduction_indices: The dimensions to reduce. If `None` (the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
diff --git a/tensorflow/python/ops/nn.py b/tensorflow/python/ops/nn.py
index 6b4abea4d2..c3d966527e 100644
--- a/tensorflow/python/ops/nn.py
+++ b/tensorflow/python/ops/nn.py
@@ -55,7 +55,7 @@ strided according to the `strides` argument. `strides = [1, 1, 1, 1]` applies
the filter to a patch at every offset, `strides = [1, 2, 2, 1]` applies the
filter to every other image patch in each dimension, etc.
-Ignoring channels for the moment, and assume that the the 4-D `input` has shape
+Ignoring channels for the moment, and assume that the 4-D `input` has shape
`[batch, in_height, in_width, ...]` and the 4-D `filter` has shape
`[filter_height, filter_width, ...]`, then the spatial semantics of the
convolution ops are as follows: first, according to the padding scheme chosen
@@ -63,7 +63,7 @@ as `'SAME'` or `'VALID'`, the output size and the padding pixels are computed.
For the `'SAME'` padding, the output height and width are computed as:
out_height = ceil(float(in_height) / float(strides[1]))
- out_width = ceil(float(in_width) / float(stides[2]))
+ out_width = ceil(float(in_width) / float(strides[2]))
and the padding on the top and left are computed as:
@@ -85,7 +85,7 @@ same number of pixels on both sides.
For the `'VALID`' padding, the output height and width are computed as:
out_height = ceil(float(in_height - filter_height + 1) / float(strides[1]))
- out_width = ceil(float(in_width - filter_width + 1) / float(stides[2]))
+ out_width = ceil(float(in_width - filter_width + 1) / float(strides[2]))
and the padding values are always zero. The output is then computed as
diff --git a/tensorflow/python/ops/rnn.py b/tensorflow/python/ops/rnn.py
index f781a398eb..710b602aa5 100644
--- a/tensorflow/python/ops/rnn.py
+++ b/tensorflow/python/ops/rnn.py
@@ -167,8 +167,12 @@ def _reverse_seq(input_seq, lengths):
if lengths is None:
return list(reversed(input_seq))
+ for input_ in input_seq:
+ input_.set_shape(input_.get_shape().with_rank(2))
+
# Join into (time, batch_size, depth)
s_joined = array_ops.pack(input_seq)
+
# Reverse along dimension 0
s_reversed = array_ops.reverse_sequence(s_joined, lengths, 0, 1)
# Split again into list
@@ -227,11 +231,13 @@ def bidirectional_rnn(cell_fw, cell_bw, inputs,
name = scope or "BiRNN"
# Forward direction
with vs.variable_scope(name + "_FW"):
- output_fw, _ = rnn(cell_fw, inputs, initial_state_fw, dtype)
+ output_fw, _ = rnn(cell_fw, inputs, initial_state_fw, dtype,
+ sequence_length)
+
# Backward direction
with vs.variable_scope(name + "_BW"):
- tmp, _ = rnn(
- cell_bw, _reverse_seq(inputs, sequence_length), initial_state_bw, dtype)
+ tmp, _ = rnn(cell_bw, _reverse_seq(inputs, sequence_length),
+ initial_state_bw, dtype, sequence_length)
output_bw = _reverse_seq(tmp, sequence_length)
# Concat each of the forward/backward outputs
outputs = [array_ops.concat(1, [fw, bw])
diff --git a/tensorflow/python/ops/rnn_cell.py b/tensorflow/python/ops/rnn_cell.py
index b1a92c06e8..843487493e 100644
--- a/tensorflow/python/ops/rnn_cell.py
+++ b/tensorflow/python/ops/rnn_cell.py
@@ -144,7 +144,7 @@ class GRUCell(RNNCell):
"""Gated recurrent unit (GRU) with nunits cells."""
with vs.variable_scope(scope or type(self).__name__): # "GRUCell"
with vs.variable_scope("Gates"): # Reset gate and update gate.
- # We start with bias of 1.0 to not reset and not udpate.
+ # We start with bias of 1.0 to not reset and not update.
r, u = array_ops.split(1, 2, linear([inputs, state],
2 * self._num_units, True, 1.0))
r, u = sigmoid(r), sigmoid(u)
@@ -211,7 +211,7 @@ def _get_sharded_variable(name, shape, initializer, dtype, num_shards):
def _matmul_with_sharded_variable(tensor, sharded_tensor):
- """Multiply tensor with each tensor in sharded_tensor and column-concat."""
+ """Multiply tensor with each tensor in sharded_tensor, column-concatenated."""
return array_ops.concat(1, [math_ops.matmul(tensor, shard)
for shard in sharded_tensor])
@@ -364,7 +364,7 @@ class OutputProjectionWrapper(RNNCell):
Note: in many cases it may be more efficient to not use this wrapper,
but instead concatenate the whole sequence of your outputs in time,
- do the projection on this batch-concated sequence, then split it
+ do the projection on this batch-concatenated sequence, then split it
if needed or directly feed into a softmax.
"""
@@ -412,7 +412,7 @@ class InputProjectionWrapper(RNNCell):
Note: in many cases it may be more efficient to not use this wrapper,
but instead concatenate the whole sequence of your inputs in time,
- do the projection on this batch-concated sequence, then split it.
+ do the projection on this batch-concatenated sequence, then split it.
"""
def __init__(self, cell, input_size):
@@ -501,7 +501,7 @@ class DropoutWrapper(RNNCell):
def state_size(self):
return self._cell.state_size
- def __call__(self, inputs, state):
+ def __call__(self, inputs, state, scope=None):
"""Run the cell with the declared dropouts."""
if (not isinstance(self._input_keep_prob, float) or
self._input_keep_prob < 1):
@@ -518,7 +518,7 @@ class EmbeddingWrapper(RNNCell):
Note: in many cases it may be more efficient to not use this wrapper,
but instead concatenate the whole sequence of your inputs in time,
- do the embedding on this batch-concated sequence, then split it and
+ do the embedding on this batch-concatenated sequence, then split it and
feed into your RNN.
"""
diff --git a/tensorflow/python/summary/impl/reservoir.py b/tensorflow/python/summary/impl/reservoir.py
index c5b5daff0c..d33f787975 100644
--- a/tensorflow/python/summary/impl/reservoir.py
+++ b/tensorflow/python/summary/impl/reservoir.py
@@ -214,7 +214,7 @@ class _ReservoirBucket(object):
self.items = list(filter(filterFn, self.items))
size_diff = size_before - len(self.items)
- # Estimate a correction the the number of items seen
+ # Estimate a correction the number of items seen
prop_remaining = len(self.items) / float(
size_before) if size_before > 0 else 0
self._num_items_seen = int(round(self._num_items_seen * prop_remaining))
diff --git a/tensorflow/python/training/adagrad.py b/tensorflow/python/training/adagrad.py
index b021a002be..87edbbfdf5 100644
--- a/tensorflow/python/training/adagrad.py
+++ b/tensorflow/python/training/adagrad.py
@@ -27,6 +27,8 @@ from tensorflow.python.training import training_ops
class AdagradOptimizer(optimizer.Optimizer):
"""Optimizer that implements the Adagrad algorithm.
+ (http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf)
+
See http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf.
@@__init__
diff --git a/tensorflow/python/training/adam.py b/tensorflow/python/training/adam.py
index 8f6afc7398..df89d00dcc 100644
--- a/tensorflow/python/training/adam.py
+++ b/tensorflow/python/training/adam.py
@@ -31,6 +31,8 @@ from tensorflow.python.training import training_ops
class AdamOptimizer(optimizer.Optimizer):
"""Optimizer that implements the Adam algorithm.
+ (http://arxiv.org/pdf/1412.6980v7.pdf).
+
See http://arxiv.org/pdf/1412.6980v7.pdf.
@@__init__
diff --git a/tensorflow/python/training/coordinator.py b/tensorflow/python/training/coordinator.py
index 6c385ba597..42e13c24fa 100644
--- a/tensorflow/python/training/coordinator.py
+++ b/tensorflow/python/training/coordinator.py
@@ -215,7 +215,7 @@ class Coordinator(object):
"""Wait till the Coordinator is told to stop.
Args:
- timeout: float. Sleep for up to that many seconds waiting for
+ timeout: Float. Sleep for up to that many seconds waiting for
should_stop() to become True.
Returns:
@@ -229,7 +229,7 @@ class Coordinator(object):
Blocks until all `threads` have terminated or `request_stop()` is called.
After the threads stop, if an `exc_info` was passed to `request_stop`, that
- exception is re-reaised.
+ exception is re-raised.
Grace period handling: When `request_stop()` is called, threads are given
'stop_grace_period_secs' seconds to terminate. If any of them is still
@@ -289,7 +289,7 @@ class LooperThread(threading.Thread):
"""Create a LooperThread.
Args:
- coord: a Coordinator.
+ coord: A Coordinator.
timer_interval_secs: Time boundaries at which to call Run(), or None
if it should be called back to back.
target: Optional callable object that will be executed in the thread.
diff --git a/tensorflow/python/training/ftrl.py b/tensorflow/python/training/ftrl.py
index 3aa2b90171..06a698afce 100644
--- a/tensorflow/python/training/ftrl.py
+++ b/tensorflow/python/training/ftrl.py
@@ -249,7 +249,7 @@ class FtrlOptimizer(optimizer.Optimizer):
gradients. Defaults to "Ftrl".
Raises:
- ValueError: if one of the arguments is invalid.
+ ValueError: If one of the arguments is invalid.
"""
super(FtrlOptimizer, self).__init__(use_locking, name)
diff --git a/tensorflow/python/training/ftrl_test.py b/tensorflow/python/training/ftrl_test.py
index 062537c33b..c3eb28c4e0 100644
--- a/tensorflow/python/training/ftrl_test.py
+++ b/tensorflow/python/training/ftrl_test.py
@@ -170,7 +170,7 @@ class FtrlOptimizerTest(tf.test.TestCase):
v0_val, v1_val = sess.run([var0, var1])
return v0_val, v1_val
- # When variables are intialized with Zero, FTRL-Proximal has two properties:
+ # When variables are initialized with Zero, FTRL-Proximal has two properties:
# 1. Without L1&L2 but with fixed learning rate, FTRL-Proximal is identical
# with GradientDescent.
# 2. Without L1&L2 but with adaptive learning rate, FTRL-Proximal is identical
diff --git a/tensorflow/python/training/learning_rate_decay.py b/tensorflow/python/training/learning_rate_decay.py
index 7634085624..7d4999921f 100644
--- a/tensorflow/python/training/learning_rate_decay.py
+++ b/tensorflow/python/training/learning_rate_decay.py
@@ -65,7 +65,7 @@ def exponential_decay(learning_rate, global_step, decay_steps, decay_rate,
decay_rate: A scalar `float32` or `float64` `Tensor` or a
Python number. The decay rate.
staircase: Boolean. It `True` decay the learning rate at discrete intervals.
- name: string. Optional name of the operation. Defaults to 'ExponentialDecay'
+ name: String. Optional name of the operation. Defaults to 'ExponentialDecay'
Returns:
A scalar `Tensor` of the same type as `learning_rate`. The decayed
diff --git a/tensorflow/python/training/momentum_test.py b/tensorflow/python/training/momentum_test.py
index f7e1e3095c..79b4ebb9c7 100644
--- a/tensorflow/python/training/momentum_test.py
+++ b/tensorflow/python/training/momentum_test.py
@@ -165,7 +165,7 @@ class MomentumOptimizerTest(tf.test.TestCase):
"""Return dist-belief momentum values.
Return values been generated from the dist-belief momentum unittest,
- running with a learning rate of 0.1 and a momemntum of 0.1.
+ running with a learning rate of 0.1 and a momentum of 0.1.
These values record how a parameter vector of size 10, initialized with 0.0,
gets updated with 10 consecutive momentum steps. It uses random gradients.
diff --git a/tensorflow/python/training/moving_averages.py b/tensorflow/python/training/moving_averages.py
index 31a73f1ec3..14c77afb70 100644
--- a/tensorflow/python/training/moving_averages.py
+++ b/tensorflow/python/training/moving_averages.py
@@ -268,7 +268,7 @@ class ExponentialMovingAverage(object):
var: A `Variable` object.
Returns:
- A string: the name of the variable that will be used or was used
+ A string: The name of the variable that will be used or was used
by the `ExponentialMovingAverage class` to hold the moving average of
`var`.
"""
diff --git a/tensorflow/python/training/optimizer.py b/tensorflow/python/training/optimizer.py
index 2091687e7c..a4b8aaba2a 100644
--- a/tensorflow/python/training/optimizer.py
+++ b/tensorflow/python/training/optimizer.py
@@ -142,7 +142,7 @@ class Optimizer(object):
for the optimizer.
Raises:
- ValueError: if name is malformed.
+ ValueError: If name is malformed.
"""
if not name:
raise ValueError("Must specify the optimizer name")
@@ -179,7 +179,7 @@ class Optimizer(object):
was not `None`, that operation also increments `global_step`.
Raises:
- ValueError: if some of the variables are not `Variable` objects.
+ ValueError: If some of the variables are not `Variable` objects.
"""
grads_and_vars = self.compute_gradients(
loss, var_list=var_list, gate_gradients=gate_gradients,
@@ -255,8 +255,8 @@ class Optimizer(object):
was not None, that operation also increments `global_step`.
Raises:
- TypeError: if `grads_and_vars` is malformed.
- ValueError: if none of the variables have gradients.
+ TypeError: If `grads_and_vars` is malformed.
+ ValueError: If none of the variables have gradients.
"""
# This is a default implementation of apply_gradients() that can be shared
# by most optimizers. It relies on the subclass implementing the following
@@ -331,9 +331,10 @@ class Optimizer(object):
"""Asserts tensors are all valid types (see `_valid_dtypes`).
Args:
- tensors: tensors to check.
+ tensors: Tensors to check.
+
Raises:
- ValueError: if any tensor is not a valid type.
+ ValueError: If any tensor is not a valid type.
"""
valid_dtypes = self._valid_dtypes()
for t in tensors:
@@ -408,7 +409,7 @@ class Optimizer(object):
update_ops: List of `Operation` objects to update variables. This list
contains the values returned by the `_apply_dense()` and
`_apply_sparse()` calls.
- name_scope: string. Name to use for the returned operation.
+ name_scope: String. Name to use for the returned operation.
Returns:
The operation to apply updates.
diff --git a/tensorflow/python/training/rmsprop.py b/tensorflow/python/training/rmsprop.py
index d46ac40c1a..08c796ce42 100644
--- a/tensorflow/python/training/rmsprop.py
+++ b/tensorflow/python/training/rmsprop.py
@@ -41,6 +41,8 @@ from tensorflow.python.training import training_ops
class RMSPropOptimizer(optimizer.Optimizer):
"""Optimizer that implements the RMSProp algorithm.
+ (http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf).
+
See http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf.
@@__init__
@@ -57,11 +59,11 @@ class RMSPropOptimizer(optimizer.Optimizer):
Args:
learning_rate: A Tensor or a floating point value. The learning rate.
- decay: discounting factor for the history/coming gradient
- momentum: a scalar tensor.
- epsilon: small value to avoid zero denominator.
+ decay: Discounting factor for the history/coming gradient
+ momentum: A scalar tensor.
+ epsilon: Small value to avoid zero denominator.
use_locking: If True use locks for update operation.
- name: Optional name prefic for the operations created when applying
+ name: Optional name prefix for the operations created when applying
gradients. Defaults to "RMSProp".
"""
super(RMSPropOptimizer, self).__init__(use_locking, name)
diff --git a/tensorflow/python/training/saver.py b/tensorflow/python/training/saver.py
index 34db5c3cd3..24a068ca8d 100644
--- a/tensorflow/python/training/saver.py
+++ b/tensorflow/python/training/saver.py
@@ -71,7 +71,7 @@ class BaseSaverBuilder(object):
Args:
filename_tensor: String Tensor.
- vars_to_save: a list of BaseSaverBuilder.VarToSave objects.
+ vars_to_save: A list of BaseSaverBuilder.VarToSave objects.
Returns:
An Operation that save the variables.
@@ -91,7 +91,7 @@ class BaseSaverBuilder(object):
Args:
filename_tensor: String Tensor.
- var_to_save: a BaseSaverBuilder.VarToSave object.
+ var_to_save: A BaseSaverBuilder.VarToSave object.
preferred_shard: Int. Shard to open first when loading a sharded file.
Returns:
@@ -109,9 +109,9 @@ class BaseSaverBuilder(object):
"""Append sharding information to a filename.
Args:
- filename_tensor: a string tensor.
- shard: integer. The shard for the filename.
- num_shards: an int Tensor for the number of shards.
+ filename_tensor: A string tensor.
+ shard: Integer. The shard for the filename.
+ num_shards: An int Tensor for the number of shards.
Returns:
A string tensor.
@@ -124,7 +124,7 @@ class BaseSaverBuilder(object):
Args:
filename_tensor: String Tensor.
- vars_to_save: a list of _VarToSave objects.
+ vars_to_save: A list of _VarToSave objects.
Returns:
A tensor with the filename used to save.
@@ -167,7 +167,7 @@ class BaseSaverBuilder(object):
Args:
filename_tensor: Tensor for the path of the file to load.
- vars_to_save: a list of _VarToSave objects.
+ vars_to_save: A list of _VarToSave objects.
restore_sequentially: True if we want to restore variables sequentially
within a shard.
reshape: True if we want to reshape loaded tensors to the shape of
@@ -244,7 +244,7 @@ class BaseSaverBuilder(object):
It can happen if the devices as unspecified.
Args:
- vars_to_save: a list of BaseSaverBuilder.VarToSave objects.
+ vars_to_save: A list of BaseSaverBuilder.VarToSave objects.
Returns:
A list of tuples: (device_name, BaseSaverBuilder.VarToSave) tuples.
@@ -309,9 +309,9 @@ class BaseSaverBuilder(object):
A list of BaseSaverBuilder.VarToSave objects.
Raises:
- TypeError: if any of the keys are not strings or any of the
+ TypeError: If any of the keys are not strings or any of the
values are not one of Tensor or Variable.
- ValueError: if the same variable is given in more than one value
+ ValueError: If the same variable is given in more than one value
(this also applies to slices of SlicedVariables).
"""
if not isinstance(names_to_variables, dict):
@@ -393,13 +393,13 @@ class BaseSaverBuilder(object):
and only some times.
sharded: If True, shard the checkpoints, one per device that has
Variable nodes.
- max_to_keep: maximum number of checkpoints to keep. As new checkpoints
+ max_to_keep: Maximum number of checkpoints to keep. As new checkpoints
are created, old ones are deleted. If None or 0, no checkpoints are
deleted. Presently the number is only roughly enforced. For example
in case of restarts more than max_to_keep checkpoints may be kept.
keep_checkpoint_every_n_hours: How often checkpoints should be kept.
Defaults to 10,000 hours.
- name: string. Optional name to use as a prefix when adding operations.
+ name: String. Optional name to use as a prefix when adding operations.
restore_sequentially: A Bool, which if true, causes restore of different
variables to happen sequentially within each device.
@@ -458,6 +458,50 @@ def _GetCheckpointFilename(save_dir, latest_filename):
return os.path.join(save_dir, latest_filename)
+def generate_checkpoint_state_proto(save_dir,
+ model_checkpoint_path,
+ all_model_checkpoint_paths=None):
+ """Generates a checkpoint state proto.
+
+ Args:
+ save_dir: Directory where the model was saved.
+ model_checkpoint_path: The checkpoint file.
+ all_model_checkpoint_paths: List of strings. Paths to all not-yet-deleted
+ checkpoints, sorted from oldest to newest. If this is a non-empty list,
+ the last element must be equal to model_checkpoint_path. These paths
+ are also saved in the CheckpointState proto.
+
+ Returns:
+ CheckpointState proto with model_checkpoint_path and
+ all_model_checkpoint_paths updated to either absolute paths or
+ relative paths to the current save_dir.
+ """
+ if all_model_checkpoint_paths is None:
+ all_model_checkpoint_paths = []
+
+ if (not all_model_checkpoint_paths or
+ all_model_checkpoint_paths[-1] != model_checkpoint_path):
+ logging.info("%s is not in all_model_checkpoint_paths. Manually adding it.",
+ model_checkpoint_path)
+ all_model_checkpoint_paths.append(model_checkpoint_path)
+
+ # Relative paths need to be rewritten to be relative to the "save_dir"
+ # if model_checkpoint_path already contains "save_dir".
+ if not os.path.isabs(save_dir):
+ if not os.path.isabs(model_checkpoint_path):
+ model_checkpoint_path = os.path.relpath(model_checkpoint_path, save_dir)
+ for i in range(len(all_model_checkpoint_paths)):
+ p = all_model_checkpoint_paths[i]
+ if not os.path.isabs(p):
+ all_model_checkpoint_paths[i] = os.path.relpath(p, save_dir)
+
+ coord_checkpoint_proto = CheckpointState(
+ model_checkpoint_path=model_checkpoint_path,
+ all_model_checkpoint_paths=all_model_checkpoint_paths)
+
+ return coord_checkpoint_proto
+
+
def update_checkpoint_state(save_dir,
model_checkpoint_path,
all_model_checkpoint_paths=None,
@@ -470,7 +514,7 @@ def update_checkpoint_state(save_dir,
Args:
save_dir: Directory where the model was saved.
model_checkpoint_path: The checkpoint file.
- all_model_checkpoint_paths: list of strings. Paths to all not-yet-deleted
+ all_model_checkpoint_paths: List of strings. Paths to all not-yet-deleted
checkpoints, sorted from oldest to newest. If this is a non-empty list,
the last element must be equal to model_checkpoint_path. These paths
are also saved in the CheckpointState proto.
@@ -480,24 +524,19 @@ def update_checkpoint_state(save_dir,
Raises:
RuntimeError: If the save paths conflict.
"""
- if all_model_checkpoint_paths is None:
- all_model_checkpoint_paths = []
- elif all_model_checkpoint_paths[-1] != model_checkpoint_path:
- logging.warning(
- "%s is not in all_model_checkpoint_paths! Manually adding it.",
- model_checkpoint_path)
- all_model_checkpoint_paths.append(model_checkpoint_path)
# Writes the "checkpoint" file for the coordinator for later restoration.
coord_checkpoint_filename = _GetCheckpointFilename(save_dir, latest_filename)
- if coord_checkpoint_filename == model_checkpoint_path:
+ ckpt = generate_checkpoint_state_proto(
+ save_dir,
+ model_checkpoint_path,
+ all_model_checkpoint_paths=all_model_checkpoint_paths)
+
+ if coord_checkpoint_filename == ckpt.model_checkpoint_path:
raise RuntimeError("Save path '%s' conflicts with path used for "
"checkpoint state. Please use a different save path." %
model_checkpoint_path)
- coord_checkpoint_proto = CheckpointState(
- model_checkpoint_path=model_checkpoint_path,
- all_model_checkpoint_paths=all_model_checkpoint_paths)
f = gfile.FastGFile(coord_checkpoint_filename, mode="w")
- f.write(text_format.MessageToString(coord_checkpoint_proto))
+ f.write(text_format.MessageToString(ckpt))
f.close()
@@ -527,6 +566,16 @@ def get_checkpoint_state(checkpoint_dir, latest_filename=None):
f = gfile.FastGFile(coord_checkpoint_filename, mode="r")
ckpt = CheckpointState()
text_format.Merge(f.read(), ckpt)
+ # For relative model_checkpoint_path and all_model_checkpoint_paths,
+ # prepend checkpoint_dir.
+ if not os.path.isabs(checkpoint_dir):
+ if not os.path.isabs(ckpt.model_checkpoint_path):
+ ckpt.model_checkpoint_path = os.path.join(checkpoint_dir,
+ ckpt.model_checkpoint_path)
+ for i in range(len(ckpt.all_model_checkpoint_paths)):
+ p = ckpt.all_model_checkpoint_paths[i]
+ if not os.path.isabs(p):
+ ckpt.all_model_checkpoint_paths[i] = os.path.join(checkpoint_dir, p)
except IOError:
# It's ok if the file cannot be read
return None
@@ -676,11 +725,11 @@ class Saver(object):
reshape: If `True`, allows restoring parameters from a checkpoint
where the variables have a different shape.
sharded: If `True`, shard the checkpoints, one per device.
- max_to_keep: maximum number of recent checkpoints to keep.
- Defaults to 10,000 hours.
+ max_to_keep: Maximum number of recent checkpoints to keep.
+ Defaults to 5.
keep_checkpoint_every_n_hours: How often to keep checkpoints.
Defaults to 10,000 hours.
- name: string. Optional name to use as a prefix when adding operations.
+ name: String. Optional name to use as a prefix when adding operations.
restore_sequentially: A `Bool`, which if true, causes restore of different
variables to happen sequentially within each device. This can lower
memory usage when restoring very large models.
@@ -833,7 +882,7 @@ class Saver(object):
Args:
sess: A Session to use to save the variables.
- save_path: string. Path to the checkpoint filename. If the saver is
+ save_path: String. Path to the checkpoint filename. If the saver is
`sharded`, this is the prefix of the sharded checkpoint filename.
global_step: If provided the global step number is appended to
`save_path` to create the checkpoint filename. The optional argument
@@ -851,9 +900,14 @@ class Saver(object):
Raises:
TypeError: If `sess` is not a `Session`.
+ ValueError: If `latest_filename` contains path components.
"""
if latest_filename is None:
latest_filename = "checkpoint"
+
+ if os.path.split(latest_filename)[0]:
+ raise ValueError("'latest_filename' must not contain path components")
+
if global_step is not None:
if not isinstance(global_step, compat.integral_types):
global_step = training_util.global_step(sess, global_step)
@@ -905,9 +959,7 @@ def latest_checkpoint(checkpoint_dir, latest_filename=None):
# Pick the latest checkpoint based on checkpoint state.
ckpt = get_checkpoint_state(checkpoint_dir, latest_filename)
if ckpt and ckpt.model_checkpoint_path:
- checkpoint_pattern = os.path.join(
- checkpoint_dir, ckpt.model_checkpoint_path)
- if gfile.Glob(checkpoint_pattern):
- return checkpoint_pattern
+ if gfile.Glob(ckpt.model_checkpoint_path):
+ return ckpt.model_checkpoint_path
return None
diff --git a/tensorflow/python/training/saver_test.py b/tensorflow/python/training/saver_test.py
index af4c6a6e60..332642d9e2 100644
--- a/tensorflow/python/training/saver_test.py
+++ b/tensorflow/python/training/saver_test.py
@@ -20,6 +20,9 @@ from __future__ import print_function
import os.path
import time
+import contextlib
+import shutil
+import tempfile
import tensorflow.python.platform
@@ -583,5 +586,133 @@ class SaveRestoreWithVariableNameMap(tf.test.TestCase):
self.assertEqual(20.0, v1.eval())
+class LatestCheckpointWithRelativePaths(tf.test.TestCase):
+
+ @staticmethod
+ @contextlib.contextmanager
+ def tempWorkingDir(temppath):
+ cwd = os.getcwd()
+ os.chdir(temppath)
+ try:
+ yield
+ finally:
+ os.chdir(cwd)
+
+ @staticmethod
+ @contextlib.contextmanager
+ def tempDir():
+ tempdir = tempfile.mkdtemp()
+ try:
+ yield tempdir
+ finally:
+ shutil.rmtree(tempdir)
+
+ def testRelativePath(self):
+ # Make sure we have a clean directory to work in.
+ with self.tempDir() as tempdir:
+
+ # Jump to that directory until this test is done.
+ with self.tempWorkingDir(tempdir):
+
+ # Save training snapshots to a relative path.
+ traindir = "train/"
+ os.mkdir(traindir)
+
+ filename = "snapshot"
+ filepath = os.path.join(traindir, filename)
+
+ with self.test_session() as sess:
+ # Build a simple graph.
+ v0 = tf.Variable(0.0)
+ inc = v0.assign_add(1.0)
+
+ save = tf.train.Saver({"v0": v0})
+
+ # Record a short training history.
+ tf.initialize_all_variables().run()
+ save.save(sess, filepath, global_step=0)
+ inc.eval()
+ save.save(sess, filepath, global_step=1)
+ inc.eval()
+ save.save(sess, filepath, global_step=2)
+
+ with self.test_session() as sess:
+ # Build a new graph with different initialization.
+ v0 = tf.Variable(-1.0)
+
+ # Create a new saver.
+ save = tf.train.Saver({"v0": v0})
+ tf.initialize_all_variables().run()
+
+ # Get the most recent checkpoint name from the training history file.
+ name = tf.train.latest_checkpoint(traindir)
+ self.assertIsNotNone(name)
+
+ # Restore "v0" from that checkpoint.
+ save.restore(sess, name)
+ self.assertEquals(v0.eval(), 2.0)
+
+
+class CheckpointStateTest(tf.test.TestCase):
+
+ def _TestDir(self, test_name):
+ test_dir = os.path.join(self.get_temp_dir(), test_name)
+ if os.path.exists(test_dir):
+ shutil.rmtree(test_dir)
+ gfile.MakeDirs(test_dir)
+ return test_dir
+
+ def testAbsPath(self):
+ save_dir = self._TestDir("abs_paths")
+ abs_path = os.path.join(save_dir, "model-0")
+ ckpt = tf.train.generate_checkpoint_state_proto(save_dir, abs_path)
+ self.assertEqual(ckpt.model_checkpoint_path, abs_path)
+ self.assertTrue(os.path.isabs(ckpt.model_checkpoint_path))
+ self.assertEqual(len(ckpt.all_model_checkpoint_paths), 1)
+ self.assertEqual(ckpt.all_model_checkpoint_paths[-1], abs_path)
+
+ def testRelPath(self):
+ train_dir = "train"
+ model = os.path.join(train_dir, "model-0")
+ # model_checkpoint_path should have no "train" directory part.
+ new_rel_path = "model-0"
+ ckpt = tf.train.generate_checkpoint_state_proto(train_dir, model)
+ self.assertEqual(ckpt.model_checkpoint_path, new_rel_path)
+ self.assertEqual(len(ckpt.all_model_checkpoint_paths), 1)
+ self.assertEqual(ckpt.all_model_checkpoint_paths[-1], new_rel_path)
+
+ def testAllModelCheckpointPaths(self):
+ save_dir = self._TestDir("all_models_test")
+ abs_path = os.path.join(save_dir, "model-0")
+ for paths in [None, [], ["model-2"]]:
+ ckpt = tf.train.generate_checkpoint_state_proto(
+ save_dir,
+ abs_path,
+ all_model_checkpoint_paths=paths)
+ self.assertEqual(ckpt.model_checkpoint_path, abs_path)
+ self.assertTrue(os.path.isabs(ckpt.model_checkpoint_path))
+ self.assertEqual(
+ len(ckpt.all_model_checkpoint_paths), len(paths) if paths else 1)
+ self.assertEqual(ckpt.all_model_checkpoint_paths[-1], abs_path)
+
+ def testUpdateCheckpointState(self):
+ save_dir = self._TestDir("update_checkpoint_state")
+ os.chdir(save_dir)
+ # Make a temporary train directory.
+ train_dir = "train"
+ os.mkdir(train_dir)
+ abs_path = os.path.join(save_dir, "model-0")
+ rel_path = "train/model-2"
+ tf.train.update_checkpoint_state(
+ train_dir,
+ rel_path,
+ all_model_checkpoint_paths=[abs_path, rel_path])
+ ckpt = tf.train.get_checkpoint_state(train_dir)
+ self.assertEqual(ckpt.model_checkpoint_path, rel_path)
+ self.assertEqual(len(ckpt.all_model_checkpoint_paths), 2)
+ self.assertEqual(ckpt.all_model_checkpoint_paths[-1], rel_path)
+ self.assertEqual(ckpt.all_model_checkpoint_paths[0], abs_path)
+
+
if __name__ == "__main__":
tf.test.main()
diff --git a/tensorflow/python/training/summary_io.py b/tensorflow/python/training/summary_io.py
index 0d5be7cfd3..08ce127657 100644
--- a/tensorflow/python/training/summary_io.py
+++ b/tensorflow/python/training/summary_io.py
@@ -105,7 +105,7 @@ class SummaryWriter(object):
def add_summary(self, summary, global_step=None):
"""Adds a `Summary` protocol buffer to the event file.
- This method wraps the provided summary in an `Event` procotol buffer
+ This method wraps the provided summary in an `Event` protocol buffer
and adds it to the event file.
You can pass the result of evaluating any summary op, using
@@ -178,8 +178,8 @@ class _EventLoggerThread(threading.Thread):
"""Creates an _EventLoggerThread.
Args:
- queue: a Queue from which to dequeue events.
- ev_writer: an event writer. Used to log brain events for
+ queue: A Queue from which to dequeue events.
+ ev_writer: An event writer. Used to log brain events for
the visualizer.
flush_secs: How often, in seconds, to flush the
pending file to disk.
diff --git a/tensorflow/python/training/summary_writer_test.py b/tensorflow/python/training/summary_writer_test.py
index 0dfb9c24db..992f1d7cb4 100644
--- a/tensorflow/python/training/summary_writer_test.py
+++ b/tensorflow/python/training/summary_writer_test.py
@@ -42,7 +42,7 @@ class SummaryWriterTestCase(tf.test.TestCase):
def _EventsReader(self, test_dir):
event_paths = glob.glob(os.path.join(test_dir, "event*"))
- # If the tests runs multiple time in the same directory we can have
+ # If the tests runs multiple times in the same directory we can have
# more than one matching event file. We only want to read the last one.
self.assertTrue(event_paths)
return tf.train.summary_iterator(event_paths[-1])
diff --git a/tensorflow/python/training/training.py b/tensorflow/python/training/training.py
index 28c820bbb3..13c694ac4c 100644
--- a/tensorflow/python/training/training.py
+++ b/tensorflow/python/training/training.py
@@ -86,13 +86,13 @@ see [Queues](../../api_docs/python/io_ops.md#queues).
## Summary Operations
The following ops output
-[`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto)
+[`Summary`](https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/framework/summary.proto)
protocol buffers as serialized string tensors.
You can fetch the output of a summary op in a session, and pass it to
a [SummaryWriter](../../api_docs/python/train.md#SummaryWriter) to append it
to an event file. Event files contain
-[`Event`](https://www.tensorflow.org/code/tensorflow/core/util/event.proto)
+[`Event`](https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/util/event.proto)
protos that can contain `Summary` protos along with the timestamp and
step. You can then use TensorBoard to visualize the contents of the
event files. See [TensorBoard and
@@ -146,6 +146,7 @@ from tensorflow.python.training.queue_runner import *
from tensorflow.python.training import input as _input
from tensorflow.python.training.input import *
+from tensorflow.python.training.saver import generate_checkpoint_state_proto
from tensorflow.python.training.saver import get_checkpoint_state
from tensorflow.python.training.saver import latest_checkpoint
from tensorflow.python.training.saver import Saver
diff --git a/tensorflow/tensorboard/components/tf-categorizer/demo/index.html b/tensorflow/tensorboard/components/tf-categorizer/demo/index.html
index 9cfe6ed0b2..2c632e81c0 100644
--- a/tensorflow/tensorboard/components/tf-categorizer/demo/index.html
+++ b/tensorflow/tensorboard/components/tf-categorizer/demo/index.html
@@ -62,6 +62,7 @@
<template is="dom-repeat" items="[[item.tags]]">
<span class="tag layout vertical center-center">[[item]]</span>
</template>
+ </div>
</div>
</template>
</div>
diff --git a/tensorflow/tensorboard/components/tf-event-dashboard/tf-chart.html b/tensorflow/tensorboard/components/tf-event-dashboard/tf-chart.html
index 3f6fb40ece..3e2791f01e 100644
--- a/tensorflow/tensorboard/components/tf-event-dashboard/tf-chart.html
+++ b/tensorflow/tensorboard/components/tf-event-dashboard/tf-chart.html
@@ -3,7 +3,7 @@
<link rel="import" href="../tf-imports/lodash.html">
<!--
-tf-chart (TFChart) creates an element that draws a line chart for dispalying event values.
+tf-chart (TFChart) creates an element that draws a line chart for displaying event values.
It has the following settable properties:
tag: (required, string) - the name of the tag to load for this chart
selectedRuns: (required, string[]) - the runs the chart should display
diff --git a/tensorflow/tensorboard/components/tf-event-dashboard/tf-chart.ts b/tensorflow/tensorboard/components/tf-event-dashboard/tf-chart.ts
index f784ac8c91..179a0ae96d 100644
--- a/tensorflow/tensorboard/components/tf-event-dashboard/tf-chart.ts
+++ b/tensorflow/tensorboard/components/tf-event-dashboard/tf-chart.ts
@@ -85,7 +85,8 @@ module TF {
let idx: number = _.sortedIndex(xs, x);
if (idx === 0 || idx === data.length) {
// Only find a point when the cursor is inside the range of the data
- // if the cursor is to the left or right of all the data, dont attach.
+ // if the cursor is to the left or right of all the data, don't
+ // attach.
return;
}
let previous = data[idx - 1];
diff --git a/tensorflow/tensorboard/components/tf-graph-common/lib/colors.ts b/tensorflow/tensorboard/components/tf-graph-common/lib/colors.ts
index 2c699d2749..f3afe55e30 100644
--- a/tensorflow/tensorboard/components/tf-graph-common/lib/colors.ts
+++ b/tensorflow/tensorboard/components/tf-graph-common/lib/colors.ts
@@ -14,135 +14,126 @@ limitations under the License.
==============================================================================*/
module tf {
+ /**
+ * Mapping from color palette name to color palette, which contains
+ * exact colors for multiple states of a single color palette.
+ */
+ export let COLORS =
+ [
+ {
+ "name": "Google Blue",
+ "color": "#4184f3",
+ "active": "#3a53c5",
+ "disabled": "#cad8fc"
+ },
+ {
+ "name": "Google Red",
+ "color": "#db4437",
+ "active": "#8f2a0c",
+ "disabled": "#e8c6c1"
+ },
+ {
+ "name": "Google Yellow",
+ "color": "#f4b400",
+ "active": "#db9200",
+ "disabled": "#f7e8b0"
+ },
+ {
+ "name": "Google Green",
+ "color": "#0f9d58",
+ "active": "#488046",
+ "disabled": "#c2e1cc"
+ },
+ {
+ "name": "Purple",
+ "color": "#aa46bb",
+ "active": "#5c1398",
+ "disabled": "#d7bce6"
+ },
+ {
+ "name": "Teal",
+ "color": "#00abc0",
+ "active": "#47828e",
+ "disabled": "#c2eaf2"
+ },
+ {
+ "name": "Deep Orange",
+ "color": "#ff6f42",
+ "active": "#ca4a06",
+ "disabled": "#f2cbba"
+ },
+ {
+ "name": "Lime",
+ "color": "#9d9c23",
+ "active": "#7f771d",
+ "disabled": "#f1f4c2"
+ },
+ {
+ "name": "Indigo",
+ "color": "#5b6abf",
+ "active": "#3e47a9",
+ "disabled": "#c5c8e8"
+ },
+ {
+ "name": "Pink",
+ "color": "#ef6191",
+ "active": "#ca1c60",
+ "disabled": "#e9b9ce"
+ },
+ {
+ "name": "Deep Teal",
+ "color": "#00786a",
+ "active": "#2b4f43",
+ "disabled": "#bededa"
+ },
+ {
+ "name": "Deep Pink",
+ "color": "#c1175a",
+ "active": "#75084f",
+ "disabled": "#de8cae"
+ },
+ {
+ "name": "Gray",
+ "color": "#9E9E9E", // 500
+ "active": "#424242", // 800
+ "disabled": "F5F5F5" // 100
+ }
+ ]
+ .reduce(
+ (m, c) => {
+ m[c.name] = c;
+ return m;
+ },
+ {});
-/**
- * Mapping from color palette name to color pallette, which contains
- * exact colors for multiple states of a single color pallette.
- */
-export let COLORS = [
- {
- "name": "Google Blue",
- "color": "#4184f3",
- "active": "#3a53c5",
- "disabled": "#cad8fc"
- },
- {
- "name": "Google Red",
- "color": "#db4437",
- "active": "#8f2a0c",
- "disabled": "#e8c6c1"
- },
- {
- "name": "Google Yellow",
- "color": "#f4b400",
- "active": "#db9200",
- "disabled": "#f7e8b0"
- },
- {
- "name": "Google Green",
- "color": "#0f9d58",
- "active": "#488046",
- "disabled": "#c2e1cc"
- },
- {
- "name": "Purple",
- "color": "#aa46bb",
- "active": "#5c1398",
- "disabled": "#d7bce6"
- },
- {
- "name": "Teal",
- "color": "#00abc0",
- "active": "#47828e",
- "disabled": "#c2eaf2"
- },
- {
- "name": "Deep Orange",
- "color": "#ff6f42",
- "active": "#ca4a06",
- "disabled": "#f2cbba"
- },
- {
- "name": "Lime",
- "color": "#9d9c23",
- "active": "#7f771d",
- "disabled": "#f1f4c2"
- },
- {
- "name": "Indigo",
- "color": "#5b6abf",
- "active": "#3e47a9",
- "disabled": "#c5c8e8"
- },
- {
- "name": "Pink",
- "color": "#ef6191",
- "active": "#ca1c60",
- "disabled": "#e9b9ce"
- },
- {
- "name": "Deep Teal",
- "color": "#00786a",
- "active": "#2b4f43",
- "disabled": "#bededa"
- },
- {
- "name": "Deep Pink",
- "color": "#c1175a",
- "active": "#75084f",
- "disabled": "#de8cae"
- },
- {
- "name": "Gray",
- "color": "#9E9E9E", // 500
- "active": "#424242", // 800
- "disabled": "F5F5F5" // 100
- }
-].reduce((m, c) => {
- m[c.name] = c;
- return m;
-}, {});
-
-/**
- * Mapping from op category to color palette name
- * e.g., OP_GROUP_COLORS["state_ops"] = "Google Blue";
- */
-export let OP_GROUP_COLORS = [
- {
- color: "Google Red",
- groups: ["gen_legacy_ops", "legacy_ops", "legacy_flogs_input",
- "legacy_image_input", "legacy_input_example_input",
- "legacy_sequence_input", "legacy_seti_input_input"]
- }, {
- color: "Deep Orange",
- groups: ["constant_ops"]
- }, {
- color: "Indigo",
- groups: ["state_ops"]
- }, {
- color: "Purple",
- groups: ["nn_ops", "nn"]
- }, {
- color: "Google Green",
- groups: ["math_ops"]
- }, {
- color: "Lime",
- groups: ["array_ops"]
- }, {
- color: "Teal",
- groups: ["control_flow_ops", "data_flow_ops"]
- }, {
- color: "Pink",
- groups: ["summary_ops"]
- }, {
- color: "Deep Pink",
- groups: ["io_ops"]
- }
-].reduce((m, c) => {
- c.groups.forEach(function(group) {
- m[group] = c.color;
- });
- return m;
-}, {});
+ /**
+ * Mapping from op category to color palette name
+ * e.g., OP_GROUP_COLORS["state_ops"] = "Google Blue";
+ */
+ export let OP_GROUP_COLORS =
+ [
+ {
+ color: "Google Red",
+ groups: [
+ "gen_legacy_ops", "legacy_ops", "legacy_flogs_input",
+ "legacy_image_input", "legacy_input_example_input",
+ "legacy_sequence_input", "legacy_seti_input_input"
+ ]
+ },
+ {color: "Deep Orange", groups: ["constant_ops"]},
+ {color: "Indigo", groups: ["state_ops"]},
+ {color: "Purple", groups: ["nn_ops", "nn"]},
+ {color: "Google Green", groups: ["math_ops"]},
+ {color: "Lime", groups: ["array_ops"]},
+ {color: "Teal", groups: ["control_flow_ops", "data_flow_ops"]},
+ {color: "Pink", groups: ["summary_ops"]},
+ {color: "Deep Pink", groups: ["io_ops"]}
+ ]
+ .reduce(
+ (m, c) => {
+ c.groups.forEach(function(group) { m[group] = c.color; });
+ return m;
+ },
+ {});
}
diff --git a/tensorflow/tensorboard/components/tf-graph-common/lib/common.ts b/tensorflow/tensorboard/components/tf-graph-common/lib/common.ts
index 66ed9fc84a..d93b4f69da 100644
--- a/tensorflow/tensorboard/components/tf-graph-common/lib/common.ts
+++ b/tensorflow/tensorboard/components/tf-graph-common/lib/common.ts
@@ -165,7 +165,7 @@ export function escapeQuerySelector(querySelector: string): string {
}
/**
- * TensorFlow node definition as definied in the graph proto file.
+ * TensorFlow node definition as defined in the graph proto file.
*/
export interface TFNode {
/** Name of the node */
diff --git a/tensorflow/tensorboard/components/tf-graph-common/lib/graph.ts b/tensorflow/tensorboard/components/tf-graph-common/lib/graph.ts
index dd27963cc4..ea253e45c1 100644
--- a/tensorflow/tensorboard/components/tf-graph-common/lib/graph.ts
+++ b/tensorflow/tensorboard/components/tf-graph-common/lib/graph.ts
@@ -216,7 +216,7 @@ export interface GroupNode extends Node {
* + A->Z/Y/X in GroupNode Z/Y's bridgegraph.
*
* Considering any BaseEdge then, if N is the number of path segments in the
- * source and M is the number of path semgents in the destination, then the
+ * source and M is the number of path segments in the destination, then the
* total number of bridgegraph edges you could create would be (N-1)(M-1).
*
* For this reason, it is computationally expensive to generate all the
@@ -387,7 +387,7 @@ export class NodeStats {
}
/**
- * Total number of bytes used for the node. Sum of all childen
+ * Total number of bytes used for the node. Sum of all children
* if it is a Group node.
*/
totalBytes: number;
@@ -404,7 +404,7 @@ export class NodeStats {
/**
* Combines the specified stats with the current stats.
- * Modifies the current object. This methos is used to
+ * Modifies the current object. This method is used to
* compute aggregate stats for group nodes.
*/
combine(stats: NodeStats): void {
diff --git a/tensorflow/tensorboard/components/tf-graph-common/lib/hierarchy.ts b/tensorflow/tensorboard/components/tf-graph-common/lib/hierarchy.ts
index 504e47f4d5..20147f9381 100644
--- a/tensorflow/tensorboard/components/tf-graph-common/lib/hierarchy.ts
+++ b/tensorflow/tensorboard/components/tf-graph-common/lib/hierarchy.ts
@@ -178,7 +178,7 @@ class HierarchyImpl implements Hierarchy {
};
/**
- * Given the name of a node, return the names of its predecssors.
+ * Given the name of a node, return the names of its predecessors.
* For an OpNode, this will contain the targets from the underlying BaseEdges.
* For a GroupNode, this will contain the targets truncated to siblings of
* the shared ancestor.
@@ -200,7 +200,7 @@ class HierarchyImpl implements Hierarchy {
* into the details of which of of Z/Y's descendant nodes have predecessors to
* which of A's descendants.
*
- * On the other hand, for an OpNode it's clear what the final predecssors
+ * On the other hand, for an OpNode it's clear what the final predecessors
* ought to be. There is no ambiguity.
*/
getPredecessors(nodeName: string): Edges {
@@ -246,7 +246,7 @@ class HierarchyImpl implements Hierarchy {
return successors;
}
- /** Helper method for getPredeccessors and getSuccessors */
+ /** Helper method for getPredecessors and getSuccessors */
getOneWayEdges(node: GroupNode|OpNode, inEdges: boolean) {
let edges = { control: [], regular: [] };
// A node with no parent cannot have any edges.
diff --git a/tensorflow/tensorboard/components/tf-graph-common/lib/layout.ts b/tensorflow/tensorboard/components/tf-graph-common/lib/layout.ts
index b003e33177..cb81c0cb8f 100644
--- a/tensorflow/tensorboard/components/tf-graph-common/lib/layout.ts
+++ b/tensorflow/tensorboard/components/tf-graph-common/lib/layout.ts
@@ -429,7 +429,7 @@ function dagreLayout(
});
// Shift all nodes and edge points to account for the left-padding amount,
- // and the invisble bridge nodes.
+ // and the invisible bridge nodes.
_.each(graph.nodes(), nodeName => {
let nodeInfo = graph.node(nodeName);
nodeInfo.x -= minX;
diff --git a/tensorflow/tensorboard/components/tf-graph-common/lib/render.ts b/tensorflow/tensorboard/components/tf-graph-common/lib/render.ts
index 956b39d986..3257f6f6a0 100644
--- a/tensorflow/tensorboard/components/tf-graph-common/lib/render.ts
+++ b/tensorflow/tensorboard/components/tf-graph-common/lib/render.ts
@@ -296,7 +296,7 @@ export class RenderGraphInfo {
/**
* Returns true if the renderNode is an isolated node within its parent node.
*/
- isNodeAuxilliary(renderNode: RenderNodeInfo): boolean {
+ isNodeAuxiliary(renderNode: RenderNodeInfo): boolean {
let parentNode = <RenderGroupNodeInfo>this.getRenderNodeByName(
renderNode.node.parentNode.name);
let found = _.find(parentNode.isolatedInExtract, node => {
diff --git a/tensorflow/tensorboard/components/tf-graph-dashboard/tf-graph-dashboard.html b/tensorflow/tensorboard/components/tf-graph-dashboard/tf-graph-dashboard.html
index 200372888c..7ebdc66545 100644
--- a/tensorflow/tensorboard/components/tf-graph-dashboard/tf-graph-dashboard.html
+++ b/tensorflow/tensorboard/components/tf-graph-dashboard/tf-graph-dashboard.html
@@ -76,6 +76,7 @@ by default. The user can select a different run from a dropdown menu.
color-by-params="{{_colorByParams}}">
</tf-graph-board>
</div>
+</tf-dashboard-layout>
</template>
<style>
diff --git a/tensorflow/tensorboard/components/tf-graph/tf-graph.html b/tensorflow/tensorboard/components/tf-graph/tf-graph.html
index e35664ae7f..4eeea2968e 100644
--- a/tensorflow/tensorboard/components/tf-graph/tf-graph.html
+++ b/tensorflow/tensorboard/components/tf-graph/tf-graph.html
@@ -229,7 +229,7 @@ Polymer({
renderNode.node.include = tf.graph.InclusionType.INCLUDE;
} else {
renderNode.node.include =
- this.renderHierarchy.isNodeAuxilliary(renderNode)
+ this.renderHierarchy.isNodeAuxiliary(renderNode)
? tf.graph.InclusionType.INCLUDE : tf.graph.InclusionType.EXCLUDE;
}
diff --git a/tensorflow/tensorboard/components/tf-image-dashboard/tf-image-grid.html b/tensorflow/tensorboard/components/tf-image-dashboard/tf-image-grid.html
index eb45c95b30..268c42a3d6 100644
--- a/tensorflow/tensorboard/components/tf-image-dashboard/tf-image-grid.html
+++ b/tensorflow/tensorboard/components/tf-image-dashboard/tf-image-grid.html
@@ -5,7 +5,7 @@
<link rel="import" href="../tf-dashboard-common/scrollbar-style.html">
<!--
-tf-image-grid creates a grid for examining image data. The columsn correspond
+tf-image-grid creates a grid for examining image data. The columns correspond
to runs and the rows correspond to tags. Each cell is an image.
Structurally, it makes extensive use of flexbox for layout: it has a top-level
@@ -153,7 +153,7 @@ is high)
_getTags: function(runToImages) {
return _.chain(runToImages.base).values().flatten().union().value();
},
- _getRuns(runToImages) {
+ _getRuns: function(runToImages) {
var r2i = runToImages.base;
return _.keys(r2i).filter(function(x) {return r2i[x].length > 0;});
},
diff --git a/tensorflow/tensorboard/components/tf-image-dashboard/tf-image-loader.html b/tensorflow/tensorboard/components/tf-image-dashboard/tf-image-loader.html
index 49d3d7ed01..10f03b0006 100644
--- a/tensorflow/tensorboard/components/tf-image-dashboard/tf-image-loader.html
+++ b/tensorflow/tensorboard/components/tf-image-dashboard/tf-image-loader.html
@@ -28,8 +28,8 @@ future for loading older images.
verbose="true"
></iron-ajax>
<template is="dom-if" if="[[imageUrl]]">
- <img src="[[imageUrl]]"></img>
- </template is="dom-if">
+ <img src="[[imageUrl]]">
+ </template>
</template>
<script>
Polymer({
diff --git a/tensorflow/tensorboard/components/tf-imports/dagre.html b/tensorflow/tensorboard/components/tf-imports/dagre.html
index 035c9f5911..0301ec5698 100644
--- a/tensorflow/tensorboard/components/tf-imports/dagre.html
+++ b/tensorflow/tensorboard/components/tf-imports/dagre.html
@@ -1,5 +1,5 @@
<!--
-HTML imports are non-blocking thus getting the depedency 'graphlib'
+HTML imports are non-blocking thus getting the dependency 'graphlib'
and 'lodash' via script imports instead.
-->
<script src="../lodash/lodash.min.js"></script>
diff --git a/tensorflow/tensorboard/components/tf-imports/google/README.md b/tensorflow/tensorboard/components/tf-imports/google/README.md
index 7ff4069770..60d9cce777 100644
--- a/tensorflow/tensorboard/components/tf-imports/google/README.md
+++ b/tensorflow/tensorboard/components/tf-imports/google/README.md
@@ -1,3 +1,3 @@
This file acts as import routers for third party javascript libraries,
-e.g. Plottable and D3 from `g3/third_party`; it exists to faciliate development
+e.g. Plottable and D3 from `g3/third_party`; it exists to facilitate development
inside google.
diff --git a/tensorflow/tensorboard/components/tf-multi-checkbox/tf-multi-checkbox.html b/tensorflow/tensorboard/components/tf-multi-checkbox/tf-multi-checkbox.html
index 1c4b1d2bb1..41af6a3ab8 100644
--- a/tensorflow/tensorboard/components/tf-multi-checkbox/tf-multi-checkbox.html
+++ b/tensorflow/tensorboard/components/tf-multi-checkbox/tf-multi-checkbox.html
@@ -6,7 +6,7 @@
<!--
tf-multi-checkbox creates a list of checkboxes that can be used to toggle on or off
a large number of values. Each checkbox displays a name, and may also have an
-assosciated tooltip value. Checkboxes can be highlighted, hidden, and re-ordered.
+associated tooltip value. Checkboxes can be highlighted, hidden, and re-ordered.
tf-multi-checkbox assumes that the names may be very long compared to the width
of the checkbox, and the number of names may also be very large, and works to
@@ -21,7 +21,7 @@ tooltipOrderer: A function that is used to compute how to order the names based
on tooltip values (when available). If tooltip values and a tooltip orderer are
present, the tooltipOrderer computes a numeric value for each tooltip, tooltips
with higher values are ordered first, tooltips with equal values are ordered
-lexicogrpahically, and tooltips without a value are placed last. If the
+lexicographically, and tooltips without a value are placed last. If the
tooltipOrderer is set to a falsey value (eg null), then the names are not
re-ordered based on tooltip value.
classScale: A function that maps from name to class name, which is applied as
diff --git a/tensorflow/tensorboard/components/tf-tensorboard/demo/index.html b/tensorflow/tensorboard/components/tf-tensorboard/demo/index.html
index 380f61d283..e97a1815c2 100644
--- a/tensorflow/tensorboard/components/tf-tensorboard/demo/index.html
+++ b/tensorflow/tensorboard/components/tf-tensorboard/demo/index.html
@@ -7,7 +7,7 @@
<title>TensorBoard Demo</title>
</head>
<body>
- <base href="/"></base>
+ <base href="/">
<dom-module id="x-demo">
<template>
<tf-tensorboard
diff --git a/tensorflow/tensorboard/dist/tf-tensorboard.html b/tensorflow/tensorboard/dist/tf-tensorboard.html
index 6579c31bae..78f9177d11 100644
--- a/tensorflow/tensorboard/dist/tf-tensorboard.html
+++ b/tensorflow/tensorboard/dist/tf-tensorboard.html
@@ -1826,7 +1826,7 @@ var tf;
/**
* Returns true if the renderNode is an isolated node within its parent node.
*/
- RenderGraphInfo.prototype.isNodeAuxilliary = function (renderNode) {
+ RenderGraphInfo.prototype.isNodeAuxiliary = function (renderNode) {
var parentNode = this.getRenderNodeByName(renderNode.node.parentNode.name);
var found = _.find(parentNode.isolatedInExtract, function (node) {
return node.node.name === renderNode.node.name;
@@ -7939,7 +7939,7 @@ var TF;
_getTags: function(runToImages) {
return _.chain(runToImages.base).values().flatten().union().value();
},
- _getRuns(runToImages) {
+ _getRuns: function(runToImages) {
var r2i = runToImages.base;
return _.keys(r2i).filter(function(x) {return r2i[x].length > 0;});
},
@@ -9368,7 +9368,7 @@ Polymer({
renderNode.node.include = tf.graph.InclusionType.INCLUDE;
} else {
renderNode.node.include =
- this.renderHierarchy.isNodeAuxilliary(renderNode)
+ this.renderHierarchy.isNodeAuxiliary(renderNode)
? tf.graph.InclusionType.INCLUDE : tf.graph.InclusionType.EXCLUDE;
}
diff --git a/tensorflow/tensorboard/gulpfile.js b/tensorflow/tensorboard/gulpfile.js
index 821677e648..46368d82fd 100644
--- a/tensorflow/tensorboard/gulpfile.js
+++ b/tensorflow/tensorboard/gulpfile.js
@@ -154,18 +154,18 @@ var scriptRegex = /<script src="[^"]*"><\/script>\n/g;
gulp.task('vulcanize', ['compile.all', 'tslint-strict'], function() {
// Vulcanize TensorBoard without external libraries.
gulp.src('components/tf-tensorboard/tf-tensorboard.html')
- .pipe(vulcanize({
- inlineScripts: true,
- inlineCss: true,
- stripComments: true,
- excludes: getNonTensorBoardComponents(),
- }))
- // TODO(danmane): Remove this worrysome brittleness when vulcanize
- // fixes https://github.com/Polymer/vulcanize/issues/273
- .pipe(replace(linkRegex, ''))
- .pipe(replace(scriptRegex, ''))
- .pipe(header('// AUTOGENERATED FILE - DO NOT MODIFY \n'))
- .pipe(gulp.dest('../opensource_only/tensorboard'));
+ .pipe(vulcanize({
+ inlineScripts: true,
+ inlineCss: true,
+ stripComments: true,
+ excludes: getNonTensorBoardComponents(),
+ }))
+ // TODO(danmane): Remove this worrisome brittleness when vulcanize
+ // fixes https://github.com/Polymer/vulcanize/issues/273
+ .pipe(replace(linkRegex, ''))
+ .pipe(replace(scriptRegex, ''))
+ .pipe(header('// AUTOGENERATED FILE - DO NOT MODIFY \n'))
+ .pipe(gulp.dest('../opensource_only/tensorboard'));
gulp.src('components/tf-tensorboard/tf-tensorboard-demo.html')
diff --git a/tensorflow/tensorboard/tensorboard.py b/tensorflow/tensorboard/tensorboard.py
index 1b0ff85ca1..14faf2ca09 100644
--- a/tensorflow/tensorboard/tensorboard.py
+++ b/tensorflow/tensorboard/tensorboard.py
@@ -22,11 +22,12 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import BaseHTTPServer
import functools
import os
import socket
-import SocketServer
+
+from six.moves import BaseHTTPServer
+from six.moves import socketserver
import tensorflow.python.platform
@@ -44,7 +45,7 @@ TensorBoard will look to find TensorFlow event files that it can display.
TensorBoard will recursively walk the directory structure rooted at logdir,
looking for .*tfevents.* files.
-You may also pass a comma seperated list of log directories, and TensorBoard
+You may also pass a comma separated list of log directories, and TensorBoard
will watch each directory. You can also assign names to individual log
directories by putting a colon between the name and the path, as in
@@ -112,7 +113,7 @@ def ParseEventFilesFlag(flag_value):
return files
-class ThreadedHTTPServer(SocketServer.ThreadingMixIn,
+class ThreadedHTTPServer(socketserver.ThreadingMixIn,
BaseHTTPServer.HTTPServer):
"""A threaded HTTP server."""
daemon = True
@@ -155,7 +156,7 @@ def main(unused_argv=None):
status_bar.SetupStatusBarInsideGoogle('TensorBoard %s' % tag, FLAGS.port)
print('Starting TensorBoard %s on port %d' % (tag, FLAGS.port))
- print('(You can navigate to http://localhost:%d)' % FLAGS.port)
+ print('(You can navigate to http://%s:%d)' % (FLAGS.host, FLAGS.port))
server.serve_forever()
diff --git a/tensorflow/tensorboard/tensorboard_handler.py b/tensorflow/tensorboard/tensorboard_handler.py
index ae190fef7b..3d72577c66 100644
--- a/tensorflow/tensorboard/tensorboard_handler.py
+++ b/tensorflow/tensorboard/tensorboard_handler.py
@@ -24,18 +24,21 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import BaseHTTPServer
import csv
import gzip
import imghdr
import json
import mimetypes
import os
-import StringIO
-import urlparse
+from six import BytesIO
+from six.moves import BaseHTTPServer
from six.moves import urllib
from six.moves import xrange # pylint: disable=redefined-builtin
+from six.moves.urllib import parse as urlparse
+
+from tensorflow import compat
+
from google.protobuf import text_format
import tensorflow.python.platform
@@ -143,9 +146,9 @@ class TensorboardHandler(BaseHTTPServer.BaseHTTPRequestHandler):
content_type: The mime type of the content.
code: The numeric HTTP status code to use.
"""
- out = StringIO.StringIO()
- f = gzip.GzipFile(fileobj=out, mode='w')
- f.write(content)
+ out = BytesIO()
+ f = gzip.GzipFile(fileobj=out, mode='wb')
+ f.write(compat.as_bytes(content))
f.close()
gzip_content = out.getvalue()
self.send_response(code)
@@ -171,7 +174,7 @@ class TensorboardHandler(BaseHTTPServer.BaseHTTPRequestHandler):
self.send_header('Content-Type', 'application/json')
self.send_header('Content-Length', len(output))
self.end_headers()
- self.wfile.write(output)
+ self.wfile.write(compat.as_bytes(output))
def _send_csv_response(self, serialized_csv, code=200):
"""Writes out the given string, which represents CSV data.
@@ -198,7 +201,7 @@ class TensorboardHandler(BaseHTTPServer.BaseHTTPRequestHandler):
values = self._multiplexer.Scalars(run, tag)
if query_params.get('format') == _OutputFormat.CSV:
- string_io = StringIO.StringIO()
+ string_io = BytesIO()
writer = csv.writer(string_io)
writer.writerow(['Wall time', 'Step', 'Value'])
writer.writerows(values)
@@ -237,7 +240,7 @@ class TensorboardHandler(BaseHTTPServer.BaseHTTPRequestHandler):
run = query_params.get('run')
compressed_histograms = self._multiplexer.CompressedHistograms(run, tag)
if query_params.get('format') == _OutputFormat.CSV:
- string_io = StringIO.StringIO()
+ string_io = BytesIO()
writer = csv.writer(string_io)
# Build the headers; we have two columns for timing and two columns for
diff --git a/tensorflow/tools/ci_build/Dockerfile.android b/tensorflow/tools/ci_build/Dockerfile.android
index 3bf3e0ce00..0bffe80fcb 100644
--- a/tensorflow/tools/ci_build/Dockerfile.android
+++ b/tensorflow/tools/ci_build/Dockerfile.android
@@ -12,7 +12,6 @@ RUN /install/install_bazel.sh
# Set up bazelrc.
COPY install/.bazelrc /root/.bazelrc
-RUN chmod 0644 /root/.bazelrc
ENV BAZELRC /root/.bazelrc
# Install extra libraries for android sdk.
@@ -24,7 +23,7 @@ RUN apt-get update && apt-get install -y \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
-# Android SDK and NDK root direcotry workaround. For details see
+# Android SDK and NDK root directory workaround. For details see
# https://github.com/bazelbuild/bazel/issues/714#issuecomment-166735874
ENV ANDROID_DEV_HOME /android
RUN mkdir -p ${ANDROID_DEV_HOME}
diff --git a/tensorflow/tools/ci_build/Dockerfile.cpu b/tensorflow/tools/ci_build/Dockerfile.cpu
index 2e79ef5d2f..7bef5e07fe 100644
--- a/tensorflow/tools/ci_build/Dockerfile.cpu
+++ b/tensorflow/tools/ci_build/Dockerfile.cpu
@@ -12,5 +12,4 @@ RUN /install/install_bazel.sh
# Set up bazelrc.
COPY install/.bazelrc /root/.bazelrc
-RUN chmod 0644 /root/.bazelrc
ENV BAZELRC /root/.bazelrc
diff --git a/tensorflow/tools/ci_build/Dockerfile.gpu b/tensorflow/tools/ci_build/Dockerfile.gpu
index 1e80b99b83..b57d1d18c1 100644
--- a/tensorflow/tools/ci_build/Dockerfile.gpu
+++ b/tensorflow/tools/ci_build/Dockerfile.gpu
@@ -12,7 +12,6 @@ RUN /install/install_bazel.sh
# Set up bazelrc.
COPY install/.bazelrc /root/.bazelrc
-RUN chmod 0644 /root/.bazelrc
ENV BAZELRC /root/.bazelrc
# Set up CUDA variables
diff --git a/tensorflow/tools/ci_build/builds/configured b/tensorflow/tools/ci_build/builds/configured
index 4bb3a5d1b0..cf9ae8a21e 100755
--- a/tensorflow/tools/ci_build/builds/configured
+++ b/tensorflow/tools/ci_build/builds/configured
@@ -14,7 +14,7 @@
# limitations under the License.
# ==============================================================================
-# This script is a wrapper to run any build inside the docker cotainer
+# This script is a wrapper to run any build inside the docker container
# when running ci_build.sh. It's purpose is to automate the call of ./configure.
# Yes, this script is a workaround of a workaround.
@@ -24,9 +24,11 @@ CONTAINER_TYPE=$( echo "$1" | tr '[:upper:]' '[:lower:]' )
shift 1
COMMAND=("$@")
-export PYTHON_BIN_PATH=$(which python)
+export PYTHON_BIN_PATH="${PYTHON_BIN_PATH:-$(which python)}"
if [ "${CONTAINER_TYPE}" == "gpu" ]; then
export TF_NEED_CUDA=1
+else
+ export TF_NEED_CUDA=0
fi
./configure
diff --git a/tensorflow/tools/ci_build/builds/with_the_same_user b/tensorflow/tools/ci_build/builds/with_the_same_user
index c86bc7e712..3e45c0b4f7 100755
--- a/tensorflow/tools/ci_build/builds/with_the_same_user
+++ b/tensorflow/tools/ci_build/builds/with_the_same_user
@@ -25,8 +25,12 @@ set -e
COMMAND=("$@")
-addgroup --gid $CI_BUILD_GID $CI_BUILD_GROUP
-adduser --gid $CI_BUILD_GID --uid $CI_BUILD_UID --disabled-password \
- --home $CI_BUILD_HOME --quiet $CI_BUILD_USER
+getent group "${CI_BUILD_GID}" || addgroup --gid "${CI_BUILD_GID}" "${CI_BUILD_GROUP}"
+getent passwd "${CI_BUILD_UID}" || adduser --gid "${CI_BUILD_GID}" --uid "${CI_BUILD_UID}" \
+ --gecos "${CI_BUILD_USER} (generated by with_the_same_user script)" \
+ --disabled-password --home "${CI_BUILD_HOME}" --quiet "${CI_BUILD_USER}"
-sudo -u $CI_BUILD_USER --preserve-env -H ${COMMAND[@]}
+cp /root/.bazelrc "${CI_BUILD_HOME}/.bazelrc"
+chown "${CI_BUILD_UID}:${CI_BUILD_GID}" "${CI_BUILD_HOME}/.bazelrc"
+
+sudo -u "#${CI_BUILD_UID}" --preserve-env -H ${COMMAND[@]}
diff --git a/tensorflow/tools/ci_build/ci_build.sh b/tensorflow/tools/ci_build/ci_build.sh
index fd2d513330..6d800ce5a5 100755
--- a/tensorflow/tools/ci_build/ci_build.sh
+++ b/tensorflow/tools/ci_build/ci_build.sh
@@ -76,7 +76,9 @@ docker run \
-e "CI_BUILD_GID=$(id -g $USER)" \
-v ${WORKSPACE}:/tensorflow \
-w /tensorflow \
- ${BUILD_TAG}.${CONTAINER_TYPE} \
+ ${CI_BUILD_DOCKER_RUN_EXTRA_PARAMETERS[@]} \
+ "${BUILD_TAG}.${CONTAINER_TYPE}" \
+ ${CI_BUILD_DOCKER_RUN_COMMAND_PREFIX[@]} \
"tensorflow/tools/ci_build/builds/with_the_same_user" \
"tensorflow/tools/ci_build/builds/configured" \
- "${CONTAINER_TYPE}" "${COMMAND[@]}"
+ "${CONTAINER_TYPE}" ${COMMAND[@]}
diff --git a/tensorflow/tools/ci_build/install/install_bazel.sh b/tensorflow/tools/ci_build/install/install_bazel.sh
index f79adab82e..8c3aa2b639 100755
--- a/tensorflow/tools/ci_build/install/install_bazel.sh
+++ b/tensorflow/tools/ci_build/install/install_bazel.sh
@@ -17,7 +17,7 @@
set -e
# Select bazel version.
-BAZEL_VERSION="0.1.1"
+BAZEL_VERSION="0.1.4"
# Install bazel.
mkdir /bazel
diff --git a/tensorflow/tools/ci_build/install/install_deb_packages.sh b/tensorflow/tools/ci_build/install/install_deb_packages.sh
index 1abe760e08..9074cdcce6 100755
--- a/tensorflow/tools/ci_build/install/install_deb_packages.sh
+++ b/tensorflow/tools/ci_build/install/install_deb_packages.sh
@@ -26,6 +26,9 @@ apt-get install -y \
python-dev \
python-numpy \
python-pip \
+ python3-dev \
+ python3-numpy \
+ python3-pip \
software-properties-common \
swig \
unzip \
diff --git a/tensorflow/tools/docker/Dockerfile.devel b/tensorflow/tools/docker/Dockerfile.devel
index 086c11314c..d361135e8a 100644
--- a/tensorflow/tools/docker/Dockerfile.devel
+++ b/tensorflow/tools/docker/Dockerfile.devel
@@ -64,7 +64,7 @@ RUN echo "build --spawn_strategy=standalone --genrule_strategy=standalone" \
>>/root/.bazelrc
ENV BAZELRC /root/.bazelrc
# Install the most recent bazel release.
-ENV BAZEL_VERSION 0.1.1
+ENV BAZEL_VERSION 0.1.4
WORKDIR /
RUN mkdir /bazel && \
cd /bazel && \
diff --git a/tensorflow/tools/docker/Dockerfile.devel-gpu b/tensorflow/tools/docker/Dockerfile.devel-gpu
index 753e230869..b0e7cb8d06 100644
--- a/tensorflow/tools/docker/Dockerfile.devel-gpu
+++ b/tensorflow/tools/docker/Dockerfile.devel-gpu
@@ -64,7 +64,7 @@ RUN echo "build --spawn_strategy=standalone --genrule_strategy=standalone" \
>>/root/.bazelrc
ENV BAZELRC /root/.bazelrc
# Install the most recent bazel release.
-ENV BAZEL_VERSION 0.1.1
+ENV BAZEL_VERSION 0.1.4
WORKDIR /
RUN mkdir /bazel && \
cd /bazel && \
diff --git a/third_party/eigen3/Eigen/Cholesky b/third_party/eigen3/Eigen/Cholesky
index e12ca76fb9..9bb0ef64b8 100644
--- a/third_party/eigen3/Eigen/Cholesky
+++ b/third_party/eigen3/Eigen/Cholesky
@@ -1 +1 @@
-#include "external/eigen_archive/eigen-eigen-fb2fa0527077/Eigen/Cholesky"
+#include "external/eigen_archive/eigen-eigen-c8e5d094f3a9/Eigen/Cholesky"
diff --git a/third_party/eigen3/Eigen/Core b/third_party/eigen3/Eigen/Core
index 4cf93eb97d..b35c264bb8 100644
--- a/third_party/eigen3/Eigen/Core
+++ b/third_party/eigen3/Eigen/Core
@@ -1 +1 @@
-#include "external/eigen_archive/eigen-eigen-fb2fa0527077/Eigen/Core"
+#include "external/eigen_archive/eigen-eigen-c8e5d094f3a9/Eigen/Core"
diff --git a/third_party/eigen3/Eigen/Eigenvalues b/third_party/eigen3/Eigen/Eigenvalues
index 3eb6c6f09d..6fa81bae97 100644
--- a/third_party/eigen3/Eigen/Eigenvalues
+++ b/third_party/eigen3/Eigen/Eigenvalues
@@ -1 +1 @@
-#include "external/eigen_archive/eigen-eigen-fb2fa0527077/Eigen/Eigenvalues"
+#include "external/eigen_archive/eigen-eigen-c8e5d094f3a9/Eigen/Eigenvalues"
diff --git a/third_party/eigen3/Eigen/LU b/third_party/eigen3/Eigen/LU
index fb2f42d69e..86a66943c6 100644
--- a/third_party/eigen3/Eigen/LU
+++ b/third_party/eigen3/Eigen/LU
@@ -1 +1 @@
-#include "external/eigen_archive/eigen-eigen-fb2fa0527077/Eigen/LU"
+#include "external/eigen_archive/eigen-eigen-c8e5d094f3a9/Eigen/LU"
diff --git a/third_party/eigen3/unsupported/Eigen/CXX11/Tensor b/third_party/eigen3/unsupported/Eigen/CXX11/Tensor
index ed198435a4..19144a729e 100644
--- a/third_party/eigen3/unsupported/Eigen/CXX11/Tensor
+++ b/third_party/eigen3/unsupported/Eigen/CXX11/Tensor
@@ -1 +1 @@
-#include "external/eigen_archive/eigen-eigen-fb2fa0527077/unsupported/Eigen/CXX11/Tensor"
+#include "external/eigen_archive/eigen-eigen-c8e5d094f3a9/unsupported/Eigen/CXX11/Tensor"
diff --git a/third_party/gpus/crosstool/CROSSTOOL b/third_party/gpus/crosstool/CROSSTOOL
index 3570c5c8a2..629dc32f30 100644
--- a/third_party/gpus/crosstool/CROSSTOOL
+++ b/third_party/gpus/crosstool/CROSSTOOL
@@ -107,6 +107,7 @@ toolchain {
# Anticipated future default.
linker_flag: "-no-canonical-prefixes"
+ unfiltered_cxx_flag: "-fno-canonical-system-headers"
# Have gcc return the exit code from ld.
linker_flag: "-pass-exit-codes"
# Stamp the binary with a unique identifier.
diff --git a/tools/bazel.rc.template b/tools/bazel.rc.template
index 5aa29029be..b49fd62306 100644
--- a/tools/bazel.rc.template
+++ b/tools/bazel.rc.template
@@ -3,3 +3,7 @@ build:cuda --crosstool_top=//third_party/gpus/crosstool
build --force_python=py$PYTHON_MAJOR_VERSION
build --python$PYTHON_MAJOR_VERSION_path=$PYTHON_BINARY
build --define=use_fast_cpp_protos=true
+
+build --spawn_strategy=standalone
+test --spawn_strategy=standalone
+run --spawn_strategy=standalone