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 167933991 #12893

Merged
merged 86 commits into from
Sep 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
a8b7a32
Internal cleanup
tensorflower-gardener Sep 5, 2017
eaaa0b9
Move the Keras API to tf.keras.
fchollet Sep 5, 2017
0ab137c
Automated g4 rollback of changelist 167604306
tensorflower-gardener Sep 5, 2017
aebe8cc
Call HloComputation.Accept instead of HloInstruction.Accept to get al…
tensorflower-gardener Sep 5, 2017
db43fe6
Add fast math attributes to all generated methods when fast math enab…
tensorflower-gardener Sep 5, 2017
6078160
Extended ScratchSpace to expose its underlying scratch tensor object.
ebrevdo Sep 5, 2017
a0fc130
Change zip(...)[1] to list(zip(...))[1], for python 3 compatibility.
tensorflower-gardener Sep 6, 2017
5fe606f
Add scoped timer to log jit compile times.
tensorflower-gardener Sep 6, 2017
1fc8c67
Verify that predictions are in the expected range for ops that use th…
tensorflower-gardener Sep 6, 2017
43a8dda
Internal change.
tensorflower-gardener Sep 6, 2017
536a255
Fix list formatting
tensorflower-gardener Sep 6, 2017
0a48e13
Enable java test.
tensorflower-gardener Sep 6, 2017
406854e
Add shape functions on debug ops.
tensorflower-gardener Sep 6, 2017
2b875bd
Increase session_bundle_test to a medium test.
tensorflower-gardener Sep 6, 2017
6eac979
Include layout of convolution input data in the op_profile.
tensorflower-gardener Sep 6, 2017
1f38a9c
Fix tf.sparse_add for SparseTensor with _ref typed values.
tensorflower-gardener Sep 6, 2017
a1e3ada
Fix conversion to explicit scalar broadcast
tensorflower-gardener Sep 6, 2017
3bc074a
Add 'unknown shape' shape functions on deprecated linalg ops.
tensorflower-gardener Sep 6, 2017
0365fc5
Be more careful in IsInitalized, and log when it is called on an unknown
tensorflower-gardener Sep 6, 2017
fa0a40a
tfdbg: Refactor graph-processing code out of debug_data.py
caisq Sep 6, 2017
b71c1bb
internal
ispirmustafa Sep 6, 2017
1059490
Update MaxPoolV2Shape to support NCHV_VECT_C.
tensorflower-gardener Sep 6, 2017
c91952f
Deleting tf.contrib.learn.dnn benchmark tests.
ispirmustafa Sep 6, 2017
c4cb861
Fix off-by-one documentation error.
tensorflower-gardener Sep 6, 2017
86b94d8
contrib summaries work in eager-graph mode (with defun)
alextp Sep 6, 2017
468190c
Fix minor documentation error in ZlibInputStream.
saxenasaurabh Sep 6, 2017
8d309ba
Sets the distributed training related properties of RunConfig based o…
Sep 6, 2017
250b3a1
Improved documentation about eval ops in EstimatorSpec.
ispirmustafa Sep 6, 2017
d937d86
Automated g4 rollback of changelist 156748870
tensorflower-gardener Sep 6, 2017
0f6a17c
Make cuda_solvers_gpu.cu.cc compile with nvcc8.
tensorflower-gardener Sep 6, 2017
acc7c00
Add csv dataset example to get_started/regression.
MarkDaoust Sep 6, 2017
ca65468
Switches to OrderedDict to make the dictionary order deterministic so…
tensorflower-gardener Sep 6, 2017
2b15bad
Add int8 version of fused_conv2d_bias_activation operator for the for…
tensorflower-gardener Sep 6, 2017
722b4a8
Make the text summary write no plugin data content
tensorflower-gardener Sep 6, 2017
e089c55
Avoid unnecessary buffer allocations & deallocations
saeta Sep 6, 2017
570147d
[TF:XLA] In Literal: correctly handle operands with zero elements in
kayzhu Sep 6, 2017
6c7d1fe
Reduce batch size for resampler backward pass test, to speed up test.
tensorflower-gardener Sep 6, 2017
d528a52
Remove `SimpleGraphExecutionState::costs_`, which is unused.
mrry Sep 6, 2017
f8d4b5e
detecting cycles when users add a control edge to a graph
itsmeolivia Sep 6, 2017
53f28f7
Make writer_test avoid setting content to a string
tensorflower-gardener Sep 6, 2017
713e36c
Propagate the original stack trace when exceptions caught be Monitore…
tensorflower-gardener Sep 6, 2017
903e2af
Change trace.py to not access a graph as a default argument.
Sep 6, 2017
384337f
Added custom metric support for tf.estimator.Estimator.
ispirmustafa Sep 6, 2017
557af84
A eager Saver that allows restore on create.
tensorflower-gardener Sep 6, 2017
4d24e67
Make content field of PluginData a bytes field
tensorflower-gardener Sep 6, 2017
bd4f53f
Temporarily disable tf_should_use wrapper, since it can cause
Sep 6, 2017
033e874
Ensure using "path" as a URI will keep working.
tensorflower-gardener Sep 6, 2017
f8a43f9
Fix typo in graph transforms error message
tensorflower-gardener Sep 7, 2017
e722358
Merge changes from github.
tensorflower-gardener Sep 7, 2017
f5df2b8
Update ops-related pbtxt files.
tensorflower-gardener Sep 7, 2017
ed498a2
Go: Update generated wrapper functions for TensorFlow ops.
tensorflower-gardener Sep 7, 2017
b5fdf92
Add sloppy_interleave dataset operator.
saeta Sep 7, 2017
92570f8
Update ops-related pbtxt files.
tensorflower-gardener Sep 7, 2017
af41a02
tfdbg: Fix python3 breakage in grpc debug tests caused by bytes-type …
caisq Sep 7, 2017
27ce2a4
[XLA] Rip CheckFusionNode() out of instruction, and move it into the …
tensorflower-gardener Sep 7, 2017
9e9ffa3
Unify all profile files (graph,run_meta,op_log) into one.
tensorflower-gardener Sep 7, 2017
33acf5b
Add missing #include.
tensorflower-gardener Sep 7, 2017
05c9966
Adding test for tf.cond with a mutable boolean pred.
tensorflower-gardener Sep 7, 2017
82ae84b
Remove unused BUILD depdendencies
tensorflower-gardener Sep 7, 2017
f8da474
Merge changes from github.
tensorflower-gardener Sep 7, 2017
c5ee26b
Disable tsan for keras:wrappers_test.
tensorflower-gardener Sep 7, 2017
d8e5a8c
Fixed a typo in documentation for select_last_activations().
tensorflower-gardener Sep 7, 2017
be9b07f
Update ops-related pbtxt files.
tensorflower-gardener Sep 7, 2017
75b095a
[XLA:CPU] Use Eigen for 1D convolutions.
tensorflower-gardener Sep 7, 2017
a38d387
Added functionality to allow SqlDataset to interpret a database colum…
tensorflower-gardener Sep 7, 2017
b434353
Added `SqlDataset` to __init.py__ to include `SqlDataset` in the next
dgrazian Sep 7, 2017
5101dc3
Internal change.
tensorflower-gardener Sep 7, 2017
b007bfd
adding missing dep on jdk for gen_ops.bzl
tensorflower-gardener Sep 7, 2017
40cb77d
Reduce number of session.run calls from variable_ops_test.
tensorflower-gardener Sep 7, 2017
0575c60
Change inception v2 and v3 to use fused batchnorm
yunxing Sep 7, 2017
2494aa4
[XLA] Optionally add metadata lines to graph neighborhood dumps.
tensorflower-gardener Sep 7, 2017
90dad32
Optimize tf.device in Eager mode by caching to avoid repeated device …
tensorflower-gardener Sep 7, 2017
eb75ded
Change global step to int64 again post update.
jpienaar Sep 7, 2017
b6215a6
Provide a public property to access model_fn of an Estimator. An exam…
ispirmustafa Sep 7, 2017
f507437
Factor out Python/C++-bridge safe-pointer helpers into a separate file.
tensorflower-gardener Sep 7, 2017
d410a83
Android: make it possible to build TF with NDK 13+. The default compi…
andrewharp Sep 7, 2017
3d79401
Automated g4 rollback of changelist 167890045
tensorflower-gardener Sep 7, 2017
8dbe7dd
Cache per-device scalars when creating eager tensors, to reduce numbe…
alextp Sep 7, 2017
bf1c826
Avoids triggering memcpy for empty tensors.
alextp Sep 7, 2017
83ba41e
More C++ while loop validation
skye Sep 7, 2017
997b9f2
Fix pass names checked in harness for disabling expensive passes.
tensorflower-gardener Sep 7, 2017
54d39c1
Fix non-deterministic bug in constant folding. The shape_map was a ma…
tensorflower-gardener Sep 7, 2017
4466d59
Split reduction template instantiations into multiple files for faster
tensorflower-gardener Sep 7, 2017
ead3cd6
Fix cmake build.
tensorflower-gardener Sep 8, 2017
8d0056f
Merge commit for internal changes
yifeif Sep 8, 2017
fff97f2
Fix merge issue.
yifeif Sep 8, 2017
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: 0 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ load("//tensorflow:workspace.bzl", "tf_workspace")
# path = "<PATH_TO_SDK>",
#)
#
# Android NDK r12b is recommended (higher may cause issues with Bazel)
#android_ndk_repository(
# name="androidndk",
# path="<PATH_TO_NDK>",
Expand Down
18 changes: 18 additions & 0 deletions tensorflow/c/c_test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ static void Int32Deallocator(void* data, size_t, void* arg) {
delete[] static_cast<int32_t*>(data);
}

static void DoubleDeallocator(void* data, size_t, void* arg) {
delete[] static_cast<double*>(data);
}

TF_Tensor* Int8Tensor(const int64_t* dims, int num_dims, const char* values) {
int64_t num_values = 1;
for (int i = 0; i < num_dims; ++i) {
Expand Down Expand Up @@ -63,6 +67,14 @@ TF_Tensor* Int32Tensor(int32_t v) {
&Int32Deallocator, nullptr);
}

TF_Tensor* DoubleTensor(double v) {
const int num_bytes = sizeof(double);
double* values = new double[1];
values[0] = v;
return TF_NewTensor(TF_DOUBLE, nullptr, 0, values, num_bytes,
&DoubleDeallocator, nullptr);
}

// All the *Helper methods are used as a workaround for the restrictions that
// one cannot call ASSERT_* methods in non-void-returning functions (when
// exceptions are disabled during compilation)
Expand Down Expand Up @@ -105,6 +117,12 @@ TF_Operation* ScalarConst(int32_t v, TF_Graph* graph, TF_Status* s,
return Const(tensor.get(), graph, s, name);
}

TF_Operation* ScalarConst(double v, TF_Graph* graph, TF_Status* s,
const char* name) {
unique_tensor_ptr tensor(DoubleTensor(v), TF_DeleteTensor);
return Const(tensor.get(), graph, s, name);
}

void AddHelper(TF_Operation* l, TF_Operation* r, TF_Graph* graph, TF_Status* s,
const char* name, TF_Operation** op, bool check) {
TF_OperationDescription* desc = TF_NewOperation(graph, "AddN", name);
Expand Down
5 changes: 5 additions & 0 deletions tensorflow/c/c_test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ TF_Tensor* Int32Tensor(const std::vector<int32_t>& values);

TF_Tensor* Int32Tensor(int32_t v);

TF_Tensor* DoubleTensor(double v);

TF_Operation* Placeholder(TF_Graph* graph, TF_Status* s,
const char* name = "feed");

Expand All @@ -51,6 +53,9 @@ TF_Operation* Const(TF_Tensor* t, TF_Graph* graph, TF_Status* s,
TF_Operation* ScalarConst(int32_t v, TF_Graph* graph, TF_Status* s,
const char* name = "scalar");

TF_Operation* ScalarConst(double v, TF_Graph* graph, TF_Status* s,
const char* name = "scalar");

TF_Operation* Add(TF_Operation* l, TF_Operation* r, TF_Graph* graph,
TF_Status* s, const char* name = "add");

Expand Down
3 changes: 3 additions & 0 deletions tensorflow/c/eager/c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ TFE_TensorHandle* TFE_TensorHandleCopyToDevice(TFE_TensorHandle* h,
tensorflow::Tensor dst(
dstd->GetAllocator(tensorflow::AllocatorAttributes()), src->dtype(),
src->shape());
if (src->shape().num_elements() == 0) {
return new TFE_TensorHandle(dst, dstd);
}
tensorflow::Notification n;
dstd->tensorflow_gpu_device_info()->default_context->CopyCPUTensorToDevice(
src, dstd, &dst, [status, &n](const tensorflow::Status& s) {
Expand Down
70 changes: 68 additions & 2 deletions tensorflow/c/while_loop_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -288,20 +288,86 @@ TEST_F(CApiWhileLoopTest, NestedLoop) {
ExpectOutputValue(1, 3);
}

TEST_F(CApiWhileLoopTest, BadCondOutput) {
TEST_F(CApiWhileLoopTest, UnsetCondOutput) {
Init(1);
params_->body_outputs[0] = params_->body_inputs[0];
ExpectError(TF_INVALID_ARGUMENT,
"TF_WhileParams `cond_output` field isn't set");
}

TEST_F(CApiWhileLoopTest, BadBodyOutput) {
TEST_F(CApiWhileLoopTest, WrongCondOutputType) {
Init(1);
params_->cond_output = params_->cond_inputs[0];
params_->body_outputs[0] = params_->body_inputs[0];
ExpectError(TF_INVALID_ARGUMENT,
"BuildWhileLoop: 'cond' argument must return a boolean output, "
"got int32");
}

TEST_F(CApiWhileLoopTest, InvalidCondOutputNode) {
Init(1);
// Try to reuse node from parent graph
params_->cond_output = inputs_[0];
params_->body_outputs[0] = params_->body_inputs[0];
// TODO(skyewm): this error message could be more informative. Add explicit
// checks for this case in the while loop implementation?
ExpectError(TF_INVALID_ARGUMENT,
"Requested return node 'p0' not found in graph def");
}

TEST_F(CApiWhileLoopTest, InvalidCondOutputIndex) {
Init(1);
CreateCondGraph();
params_->cond_output.index = 100;
params_->body_outputs[0] = params_->body_inputs[0];
ExpectError(TF_INVALID_ARGUMENT,
"Invalid return output 100 of node 'less_than', which has 1 "
"output(s)");
}

// TODO(skyewm): test bad cond output shape

TEST_F(CApiWhileLoopTest, UnsetBodyOutput) {
Init(1);
CreateCondGraph();
ExpectError(TF_INVALID_ARGUMENT,
"TF_WhileParams `body_outputs[0]` field isn't set");
}

// TODO(skyewm): enable this when it works (currently doesn't error)
// TEST_F(CApiWhileLoopTest, WrongBodyOutputType) {
// Init(1);
// CreateCondGraph();
// TF_Operation* double_scalar =
// ScalarConst(1.0, params_->body_graph, s_, "double_scalar");
// params_->body_outputs[0] = {double_scalar, 0};
// ExpectError(TF_INVALID_ARGUMENT, "bad body output type");
// }

TEST_F(CApiWhileLoopTest, InvalidBodyOutputNode) {
Init(1);
CreateCondGraph();
// Try to reuse node from parent graph
params_->body_outputs[0] = inputs_[0];
// TODO(skyewm): this error message could be more informative. Add explicit
// checks for this case in the while loop implementation?
ExpectError(TF_INVALID_ARGUMENT,
"Requested return node 'p0' not found in graph def");
}

// TODO(skyewm): enable this when it works (currently segfaults!)
// TEST_F(CApiWhileLoopTest, InvalidBodyOutputIndex) {
// Init(1);
// CreateCondGraph();
// params_->body_outputs[0] = params_->body_inputs[0];
// params_->body_outputs[0].index = 100;
// ExpectError(TF_INVALID_ARGUMENT,
// "Invalid return output 100 of node 'less_than', which has 1 "
// "output(s)");
// }

// TODO(skyewm): test bad body output shape

TEST_F(CApiWhileLoopTest, NullName) {
Init(1);
CreateCondGraph();
Expand Down
15 changes: 15 additions & 0 deletions tensorflow/cc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,21 @@ cc_library_with_android_deps(
],
)

tf_cc_test(
name = "ops_while_loop_test",
size = "small",
srcs = ["ops/while_loop_test.cc"],
deps = [
":cc_ops",
":client_session",
":testutil",
":while_loop",
"//tensorflow/core:test",
"//tensorflow/core:test_main",
"//tensorflow/core:testlib",
],
)

cc_library(
name = "grad_op_registry",
srcs = ["framework/grad_op_registry.cc"],
Expand Down
14 changes: 12 additions & 2 deletions tensorflow/cc/ops/while_loop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,16 @@ Status CreateCond(const Scope& scope, const CondGraphBuilderFn& cond,
scope.NewSubScope("cond").WithControlDependencies(inputs[0]);
Output raw_cond_out;
TF_RETURN_IF_ERROR(cond(cond_scope, inputs, &raw_cond_out));

TF_RETURN_IF_ERROR(scope.graph()->IsValidOutputTensor(raw_cond_out.node(),
raw_cond_out.index()));
if (raw_cond_out.type() != DT_BOOL) {
return errors::InvalidArgument(
"BuildWhileLoop: 'cond' argument must return a boolean output, got ",
DataTypeString(raw_cond_out.type()));
}
// TODO(skyewm): check that raw_cond_out is scalar

*output = LoopCond(scope, raw_cond_out).output;
return Status::OK();
}
Expand All @@ -123,13 +128,18 @@ Status CreateBody(const Scope& scope, const BodyGraphBuilderFn& body,
Scope body_scope =
scope.NewSubScope("body").WithControlDependencies(inputs[0]);
TF_RETURN_IF_ERROR(body(body_scope, inputs, outputs));

const size_t num_loop_vars = inputs.size();
if (outputs->size() != num_loop_vars) {
return errors::InvalidArgument(
"BuildWhileLoop: 'body' argument expected to return ", num_loop_vars,
"outputs, got ", outputs->size());
" output(s), got ", outputs->size());
}
for (const Output& output : *outputs) {
TF_RETURN_IF_ERROR(
scope.graph()->IsValidOutputTensor(output.node(), output.index()));
// TODO(skyewm): check output types/shapes
}
// TODO(skyewm): check output types/shapes
return Status::OK();
}

Expand Down