Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch 184768730 #16819

Merged
merged 43 commits into from
Feb 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
60b4211
Rollback of CL 183879566, and fix Windows CMAKE build by copying one …
tensorflower-gardener Feb 6, 2018
2341e3f
mcmc_diagnostics.py added to contrib/bayesflow/. potential_scale_red…
langmore Feb 6, 2018
4babfb4
Makes ResourceVariables return correct initialized_value and initial_…
tensorflower-gardener Feb 6, 2018
883559f
Remove redundant calls to realloc dynamic tensors.
tensorflower-gardener Feb 6, 2018
ef8c086
Make namedtuples with identical name and field names to be considered…
tensorflower-gardener Feb 6, 2018
ec6e45e
Java: Update to 1.6.0-rc0
asimshankar Feb 6, 2018
59c8e2a
Add a utility function to partition TensorFlow Lite graphs into subgr…
aselle Feb 6, 2018
c446422
Fix bug in and speed up ConstantFolding::CreateNodeDef():
tensorflower-gardener Feb 6, 2018
c9527bf
Explicitly specify the value of all the attributes for the newly crea…
benoitsteiner Feb 6, 2018
993398d
Add local interconnect data to DeviceLocality.
tensorflower-gardener Feb 6, 2018
1f512c7
Use the function name as the grappler item id
benoitsteiner Feb 6, 2018
78b0e87
Support training with model parallelism in tpu_estimator.
tensorflower-gardener Feb 6, 2018
8ca4366
Enable layout optimizer by default
Feb 6, 2018
5fb3c20
Adding tf_export decorators/calls to TensorFlow functions and constants.
annarev Feb 6, 2018
893a4a5
Internal change
Feb 6, 2018
1af9e83
Contrib estimator should handle ResourceVariables properly.
alextp Feb 6, 2018
7b2e603
Support resource variables in moving averages.
alextp Feb 6, 2018
51d6082
Estimator should handle ResourceVariables correctly.
alextp Feb 6, 2018
d9df431
Improve side_effect_guards to (1) avoid aliasing non-tensors and (2) …
tensorflower-gardener Feb 6, 2018
87b29b7
Second, cleaner, attempt at external control dependency handling.
alextp Feb 6, 2018
a9a8dbc
tfdbg: deflake session_debug_file_test
caisq Feb 6, 2018
ff647be
Fixed typo
tensorflower-gardener Feb 6, 2018
6dbbb28
Fetch OpDefs from C API instead of using python op registry in ops.py.
skye Feb 6, 2018
97983ea
[TF:XLA] Bump open source llvm revision to r324323
Feb 6, 2018
6f7c676
Fixing the issue where an escape character was being included in the …
Feb 6, 2018
d7b8bce
Add utility function which makes implicit `tf.get_variable` dependenc…
jvdillon Feb 6, 2018
d55d0d8
Added support for nested functions
benoitsteiner Feb 6, 2018
ee5a664
Make TFE_Py_FastpathExecute work for all types of ops
Feb 6, 2018
5eba03e
Another rolling back of performance regression.
alextp Feb 6, 2018
497b4fb
Export CXX11_ABI_FLAG and MONOLITHIC_BUILD constants.
annarev Feb 6, 2018
71248e6
Automated g4 rollback of changelist 184551259
jvdillon Feb 6, 2018
2139e6e
[TF Ops] Bugfix to Operation initializer: error message uses node_def.
ebrevdo Feb 6, 2018
340a9b0
Handles possible infinite recursion in while loop fix.
alextp Feb 6, 2018
af46e2c
Creates tf.contrib.feature_column module.
tensorflower-gardener Feb 6, 2018
956fb32
Add read resource variable benchmarks.
Feb 6, 2018
901d119
[XLA] Add and use new Literal::MakeTupleOwned overload.
Feb 6, 2018
0282f08
Address Adagrad/RMSProp incompatibility with CudnnRNN
protoget Feb 7, 2018
87b5c8f
Sync the opensource and non-opensource build
aselle Feb 7, 2018
9126444
Fix memory tracking in the case where temp memory is used as output m…
Feb 7, 2018
24134b1
[tf.data] Fix a memory leak when an iterator is reinitialized many ti…
mrry Feb 7, 2018
19ba08a
Merge commit for internal changes
ankurtaly Feb 7, 2018
39ee0bc
Updated copyright from 2017 to 2018
ankurtaly Feb 7, 2018
af78a01
Update BUILD
yifeif Feb 7, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions tensorflow/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ filegroup(
"//tensorflow/contrib/factorization:all_files",
"//tensorflow/contrib/factorization/examples:all_files",
"//tensorflow/contrib/factorization/kernels:all_files",
"//tensorflow/contrib/feature_column:all_files",
"//tensorflow/contrib/ffmpeg:all_files",
"//tensorflow/contrib/ffmpeg/default:all_files",
"//tensorflow/contrib/framework:all_files",
Expand Down
4 changes: 4 additions & 0 deletions tensorflow/c/c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ TF_Status* TF_NewStatus() { return new TF_Status; }
void TF_DeleteStatus(TF_Status* s) { delete s; }

void TF_SetStatus(TF_Status* s, TF_Code code, const char* msg) {
if (code == TF_OK) {
s->status = Status::OK();
return;
}
s->status = Status(static_cast<Code>(code), tensorflow::StringPiece(msg));
}

Expand Down
14 changes: 12 additions & 2 deletions tensorflow/c/eager/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ load(
"tf_cuda_cc_test",
"tf_cc_test",
"tf_copts",
"tfe_xla_copts",
"tf_cuda_library",
)

Expand All @@ -16,7 +17,7 @@ tf_cuda_library(
"c_api_internal.h",
],
hdrs = ["c_api.h"],
copts = tf_copts(),
copts = tf_copts() + tfe_xla_copts(),
visibility = ["//visibility:public"],
deps = select({
"//tensorflow:android": [
Expand All @@ -33,7 +34,15 @@ tf_cuda_library(
"//tensorflow/core:lib_internal",
"//tensorflow/core:protos_all_cc",
],
}) + ["//tensorflow/core:gpu_runtime"],
}) + select({
"//tensorflow:with_xla_support": [
"//tensorflow/compiler/tf2xla:xla_compiler",
"//tensorflow/compiler/jit",
],
"//conditions:default": [],
}) + [
"//tensorflow/core:gpu_runtime",
],
)

tf_cuda_library(
Expand All @@ -56,6 +65,7 @@ tf_cuda_library(
tf_cuda_cc_test(
name = "c_api_test",
srcs = ["c_api_test.cc"],
extra_copts = tfe_xla_copts(),
tags = [
"guitar",
"multi_gpu",
Expand Down
14 changes: 13 additions & 1 deletion tensorflow/c/eager/c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ limitations under the License.
#include "tensorflow/c/c_api_internal.h"
#include "tensorflow/c/eager/c_api_internal.h"
#include "tensorflow/c/eager/runtime.h"
#ifdef TENSORFLOW_EAGER_USE_XLA
#include "tensorflow/compiler/tf2xla/xla_op_registry.h"
#endif // TENSORFLOW_EAGER_USE_XLA
#include "tensorflow/core/common_runtime/copy_tensor.h"
#include "tensorflow/core/common_runtime/device_factory.h"
#include "tensorflow/core/common_runtime/device_mgr.h"
Expand All @@ -48,6 +51,12 @@ bool IsCPU(tensorflow::Device* d) {
return d == nullptr || d->tensorflow_gpu_device_info() == nullptr;
}

bool IsXLA(tensorflow::Device* d) {
if (d == nullptr) return false;
const auto& device_type = d->attributes().device_type();
return device_type.find("XLA") != std::string::npos;
}

string DeviceName(tensorflow::Device* d) {
return (d == nullptr) ? "cpu:0" : d->name();
}
Expand Down Expand Up @@ -183,7 +192,10 @@ TFE_TensorHandle* TFE_TensorHandleCopyToDevice(TFE_TensorHandle* h,
(srcd == dstd) || (DeviceName(srcd) == DeviceName(dstd));
const bool dst_cpu = IsCPU(dstd);
const bool src_cpu = IsCPU(srcd);
if (is_same_device) {
// both_on_cpu can be true and yet is_same_device is false, if one of src/dst
// has device type XLA_CPU, and the other CPU.
const bool both_on_cpu = src_cpu && dst_cpu;
if (is_same_device || both_on_cpu) {
return new TFE_TensorHandle(h->t, dst_cpu ? nullptr : dstd);
}
tensorflow::Tensor* src = &(h->t);
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/c/eager/runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ Status KernelAndDevice::Run(std::vector<Tensor>* input_tensors,
allocator_pair.second->GetRecordsAndUnRef();
}
auto* ms = stats->mutable_memory_stats();
ms->set_temp_memory_size(context.temp_memory_size());
ms->set_temp_memory_size(context.temp_memory_allocated());
for (const auto& alloc_id : context.persistent_alloc_ids()) {
ms->mutable_persistent_tensor_alloc_ids()->Add(alloc_id);
}
Expand Down
12 changes: 9 additions & 3 deletions tensorflow/compiler/xla/literal_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1257,11 +1257,17 @@ string Literal::ToString(bool print_layout) const {

/* static */ std::unique_ptr<Literal> Literal::MakeTupleOwned(
std::vector<std::unique_ptr<Literal>> elements) {
std::vector<const Literal*> element_ptrs;
std::vector<Shape> element_shapes;
element_shapes.reserve(elements.size());
for (const auto& element : elements) {
element_ptrs.push_back(element.get());
element_shapes.push_back(element->shape());
}
auto literal = MakeUnique<Literal>(ShapeUtil::MakeTupleShape(element_shapes));
for (int64 i = 0; i < elements.size(); ++i) {
TF_CHECK_OK(
literal->MoveFrom(std::move(*elements[i]), /*dest_shape_index=*/{i}));
}
return MakeTuple(element_ptrs);
return literal;
}

void Literal::EachCellAsString(
Expand Down
21 changes: 21 additions & 0 deletions tensorflow/compiler/xla/literal_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,27 @@ class Literal {
static std::unique_ptr<Literal> MakeTupleOwned(
std::vector<std::unique_ptr<Literal>> elements);

// This overload lets you pass a braced list of unique_ptr<Literal>s to
// MakeTupleOwned:
//
// Literal::MakeTupleOwned(Literal::CreateR1(...), ...).
//
// Simply relying on the MakeTupleOwned(std::vector<unique_ptr<Literal>>)
// overload doesn't work because std::initializer_list's elements are always
// const.
//
// The arguments to this function must all be unique_ptr<Literal>.
template <typename... Ts>
static std::unique_ptr<Literal> MakeTupleOwned(
std::unique_ptr<Ts>... elements) {
std::array<std::unique_ptr<Literal>, sizeof...(Ts)> arr{
std::move(elements)...};
std::vector<std::unique_ptr<Literal>> v;
v.insert(v.begin(), std::make_move_iterator(arr.begin()),
std::make_move_iterator(arr.end()));
return MakeTupleOwned(std::move(v));
}

// Returns a string representation of the literal value.
// Warning: this function can take minutes for multi-million element Literals.
string ToString(bool print_layout = false) const;
Expand Down
1 change: 1 addition & 0 deletions tensorflow/contrib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ py_library(
"//tensorflow/contrib/eager/python:tfe",
"//tensorflow/contrib/estimator:estimator_py",
"//tensorflow/contrib/factorization:factorization_py",
"//tensorflow/contrib/feature_column:feature_column_py",
"//tensorflow/contrib/ffmpeg:ffmpeg_ops_py",
"//tensorflow/contrib/framework:framework_py",
"//tensorflow/contrib/fused_conv:fused_conv_py",
Expand Down
1 change: 1 addition & 0 deletions tensorflow/contrib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from tensorflow.contrib import distributions
from tensorflow.contrib import estimator
from tensorflow.contrib import factorization
from tensorflow.contrib import feature_column
from tensorflow.contrib import framework
from tensorflow.contrib import gan
from tensorflow.contrib import graph_editor
Expand Down
36 changes: 36 additions & 0 deletions tensorflow/contrib/bayesflow/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,25 @@ cuda_py_test(
],
)

cuda_py_test(
name = "mcmc_diagnostics_test",
size = "small",
srcs = ["python/kernel_tests/mcmc_diagnostics_test.py"],
additional_deps = [
":bayesflow_py",
"//third_party/py/numpy",
"//tensorflow/contrib/distributions:distributions_py",
"//tensorflow/python/ops/distributions",
"//tensorflow/python:client_testlib",
"//tensorflow/python:framework",
"//tensorflow/python:framework_for_generated_wrappers",
"//tensorflow/python:framework_test_lib",
"//tensorflow/python:math_ops",
"//tensorflow/python:platform_test",
"//tensorflow/python:random_seed",
],
)

cuda_py_test(
name = "monte_carlo_test",
size = "small",
Expand Down Expand Up @@ -220,6 +239,23 @@ cuda_py_test(
tags = ["notsan"],
)

cuda_py_test(
name = "variable_utils_test",
size = "small",
srcs = ["python/kernel_tests/variable_utils_test.py"],
additional_deps = [
":bayesflow_py",
"//third_party/py/numpy",
"//tensorflow/python:client_testlib",
"//tensorflow/python:framework",
"//tensorflow/python:framework_for_generated_wrappers",
"//tensorflow/python:framework_test_lib",
"//tensorflow/python:gradients",
"//tensorflow/python:math_ops",
"//tensorflow/python:platform_test",
],
)

cuda_py_test(
name = "variational_sgd_optimizer_test",
size = "small",
Expand Down
4 changes: 4 additions & 0 deletions tensorflow/contrib/bayesflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
from tensorflow.contrib.bayesflow.python.ops import halton_sequence
from tensorflow.contrib.bayesflow.python.ops import hmc
from tensorflow.contrib.bayesflow.python.ops import layers
from tensorflow.contrib.bayesflow.python.ops import mcmc_diagnostics
from tensorflow.contrib.bayesflow.python.ops import metropolis_hastings
from tensorflow.contrib.bayesflow.python.ops import monte_carlo
from tensorflow.contrib.bayesflow.python.ops import optimizers
from tensorflow.contrib.bayesflow.python.ops import variable_utils
# pylint: enable=unused-import,line-too-long

from tensorflow.python.util.all_util import remove_undocumented
Expand All @@ -42,10 +44,12 @@
'hmc',
'layers',
'metropolis_hastings',
'mcmc_diagnostics',
'monte_carlo',
'optimizers',
'special_math',
'stochastic_variables',
'variable_utils',
'variational_inference',
]

Expand Down