diff options
author | Vijay Vasudevan <vrv@google.com> | 2016-01-27 13:54:08 -0800 |
---|---|---|
committer | Vijay Vasudevan <vrv@google.com> | 2016-01-27 14:01:22 -0800 |
commit | c3c27f275f94af6e32ecaff66a6bf439abdaff5b (patch) | |
tree | 528d0353eee14787aeefc52918afb9b32dd7bfbd /tensorflow/core/common_runtime | |
parent | 0cee1d3dac5961a08594c3734eea14fc490f3250 (diff) |
TensorFlow: ASSERT_OK and EXPECT_OK are also defined in other projects
that are built with TensorFlow (protobuf), so prefix our macros with
TF_ to make them project specific.
Change: 113197186
Diffstat (limited to 'tensorflow/core/common_runtime')
4 files changed, 73 insertions, 73 deletions
diff --git a/tensorflow/core/common_runtime/constant_folding_test.cc b/tensorflow/core/common_runtime/constant_folding_test.cc index aa5a1b1b30..a7be306b42 100644 --- a/tensorflow/core/common_runtime/constant_folding_test.cc +++ b/tensorflow/core/common_runtime/constant_folding_test.cc @@ -52,9 +52,9 @@ class ConstantFoldingTest : public ::testing::Test { TensorShape shape) { EXPECT_TRUE(n->IsConstant()); const TensorProto* tensor_proto; - EXPECT_OK(GetNodeAttr(n->def(), "value", &tensor_proto)); + TF_EXPECT_OK(GetNodeAttr(n->def(), "value", &tensor_proto)); DataType dtype; - EXPECT_OK(GetNodeAttr(n->def(), "dtype", &dtype)); + TF_EXPECT_OK(GetNodeAttr(n->def(), "dtype", &dtype)); Tensor t(dtype); EXPECT_TRUE(t.FromProto(*tensor_proto)); test::ExpectClose(t, test::AsTensor(values, shape)); diff --git a/tensorflow/core/common_runtime/direct_session_test.cc b/tensorflow/core/common_runtime/direct_session_test.cc index f4e91bb34a..9109da76dd 100644 --- a/tensorflow/core/common_runtime/direct_session_test.cc +++ b/tensorflow/core/common_runtime/direct_session_test.cc @@ -84,7 +84,7 @@ TEST_F(DirectSessionMinusAXTest, RunSimpleNetwork) { Initialize({3, 2, -1, 0}); std::unique_ptr<Session> session(CreateSession()); ASSERT_TRUE(session != nullptr); - ASSERT_OK(session->Create(def_)); + TF_ASSERT_OK(session->Create(def_)); std::vector<std::pair<string, Tensor>> inputs; // Request two targets: one fetch output and one non-fetched output. @@ -92,7 +92,7 @@ TEST_F(DirectSessionMinusAXTest, RunSimpleNetwork) { std::vector<string> target_nodes = {y_neg_}; std::vector<Tensor> outputs; Status s = session->Run(inputs, output_names, target_nodes, &outputs); - ASSERT_OK(s); + TF_ASSERT_OK(s); ASSERT_EQ(1, outputs.size()); // The first output should be initialized and have the correct @@ -107,7 +107,7 @@ TEST_F(DirectSessionMinusAXTest, TestFeed) { std::unique_ptr<Session> session(CreateSession()); ASSERT_TRUE(session != nullptr); - ASSERT_OK(session->Create(def_)); + TF_ASSERT_OK(session->Create(def_)); // Fill in the input and ask for the output // @@ -121,7 +121,7 @@ TEST_F(DirectSessionMinusAXTest, TestFeed) { // Run the graph Status s = session->Run(inputs, output_names, {}, &outputs); - ASSERT_OK(s); + TF_ASSERT_OK(s); ASSERT_EQ(1, outputs.size()); auto mat = outputs[0].matrix<float>(); @@ -135,7 +135,7 @@ TEST_F(DirectSessionMinusAXTest, TestConcurrency) { Initialize({1, 2, 3, 4}); std::unique_ptr<Session> session(CreateSession()); ASSERT_TRUE(session != nullptr); - ASSERT_OK(session->Create(def_)); + TF_ASSERT_OK(session->Create(def_)); // Fill in the input and ask for the output thread::ThreadPool* tp = new thread::ThreadPool(Env::Default(), "test", 4); @@ -172,7 +172,7 @@ TEST_F(DirectSessionMinusAXTest, TestPerSessionThreads) { std::unique_ptr<Session> session(NewSession(options)); ASSERT_TRUE(session != nullptr); - ASSERT_OK(session->Create(def_)); + TF_ASSERT_OK(session->Create(def_)); // Fill in the input and ask for the output thread::ThreadPool* tp = new thread::ThreadPool(Env::Default(), "test", 4); @@ -204,7 +204,7 @@ TEST_F(DirectSessionMinusAXTest, TwoCreateCallsFails) { Initialize({1, 2, 3, 4}); std::unique_ptr<Session> session(CreateSession()); ASSERT_TRUE(session != nullptr); - ASSERT_OK(session->Create(def_)); + TF_ASSERT_OK(session->Create(def_)); // Second is not. ASSERT_FALSE(session->Create(def_).ok()); @@ -239,7 +239,7 @@ TEST_F(DirectSessionMinusAXTest, InvalidDevice) { std::unique_ptr<Session> session(CreateSession()); ASSERT_TRUE(session != nullptr); - ASSERT_OK(session->Create(def)); + TF_ASSERT_OK(session->Create(def)); std::vector<std::pair<string, Tensor>> inputs; std::vector<string> output_names = {y->name() + ":0"}; std::vector<Tensor> outputs; @@ -252,8 +252,8 @@ TEST_F(DirectSessionMinusAXTest, InvalidDevice) { y->set_assigned_device_name("/job:localhost/replica:0/task:0/cpu:1"); test::graph::ToGraphDef(&graph, &def); session.reset(CreateSession()); - ASSERT_OK(session->Create(def)); - ASSERT_OK(session->Run(inputs, output_names, {}, &outputs)); + TF_ASSERT_OK(session->Create(def)); + TF_ASSERT_OK(session->Run(inputs, output_names, {}, &outputs)); } TEST(DirectSessionTest, KeepsStateAcrossRunsOfSession) { @@ -278,18 +278,18 @@ TEST(DirectSessionTest, KeepsStateAcrossRunsOfSession) { std::unique_ptr<Session> session(CreateSession()); ASSERT_TRUE(session != nullptr); - ASSERT_OK(session->Create(def)); + TF_ASSERT_OK(session->Create(def)); std::vector<std::pair<string, Tensor>> inputs; std::vector<Tensor> outputs; // Initialize the variable Status s = session->Run(inputs, {init->name()}, {}, &outputs); - ASSERT_OK(s); + TF_ASSERT_OK(s); // Get the variable's data s = session->Run(inputs, {var->name() + ":0"}, {}, &outputs); - ASSERT_OK(s); + TF_ASSERT_OK(s); ASSERT_EQ(1, outputs.size()); ASSERT_TRUE(outputs[0].IsInitialized()); EXPECT_EQ(20.0, outputs[0].flat<float>()(0)); @@ -315,7 +315,7 @@ TEST(DirectSessionTest, MultipleFeedTest) { std::unique_ptr<Session> session(CreateSession()); ASSERT_TRUE(session != nullptr); - ASSERT_OK(session->Create(def)); + TF_ASSERT_OK(session->Create(def)); std::vector<Tensor> outputs; @@ -389,7 +389,7 @@ TEST(DirectSessionTest, DarthKernel) { GraphDef def; test::graph::ToGraphDef(&g, &def); auto sess = CreateSession(); - ASSERT_OK(sess->Create(def)); + TF_ASSERT_OK(sess->Create(def)); std::vector<Tensor> outputs; auto s = sess->Run({}, {y->name() + ":0"}, {}, &outputs); EXPECT_TRUE(errors::IsInternal(s)); diff --git a/tensorflow/core/common_runtime/gpu/gpu_stream_util_test.cc b/tensorflow/core/common_runtime/gpu/gpu_stream_util_test.cc index 34c2d2f072..528ba73cd9 100644 --- a/tensorflow/core/common_runtime/gpu/gpu_stream_util_test.cc +++ b/tensorflow/core/common_runtime/gpu/gpu_stream_util_test.cc @@ -38,7 +38,7 @@ class GpuStreamUtilTest : public OpsTestBase { TEST_F(GpuStreamUtilTest, BogusOpts) { GraphDefBuilder b(GraphDefBuilder::kFailImmediately); Graph g(OpRegistry::Global()); - ASSERT_OK(b.ToGraph(&g)); + TF_ASSERT_OK(b.ToGraph(&g)); std::unordered_map<int, int> node_to_stream_id; gpu_stream_util::AssignStreamsOpts opts; Status status; @@ -58,10 +58,10 @@ TEST_F(GpuStreamUtilTest, BogusOpts) { TEST_F(GpuStreamUtilTest, EmptyGraph) { GraphDefBuilder b(GraphDefBuilder::kFailImmediately); Graph g(OpRegistry::Global()); - ASSERT_OK(b.ToGraph(&g)); + TF_ASSERT_OK(b.ToGraph(&g)); std::unordered_map<int, int> node_to_stream_id; gpu_stream_util::AssignStreamsOpts opts; - ASSERT_OK(gpu_stream_util::AssignStreams(&g, opts, &node_to_stream_id)); + TF_ASSERT_OK(gpu_stream_util::AssignStreams(&g, opts, &node_to_stream_id)); EXPECT_EQ(2, node_to_stream_id.size()); // _SOURCE and _SINK } @@ -70,11 +70,11 @@ TEST_F(GpuStreamUtilTest, SimpleGraphOneStream) { ops::MatMul(ops::Const(Tensor(DT_FLOAT), b.opts()), ops::Const(Tensor(DT_FLOAT), b.opts()), b.opts()); Graph g(OpRegistry::Global()); - ASSERT_OK(b.ToGraph(&g)); + TF_ASSERT_OK(b.ToGraph(&g)); std::unordered_map<int, int> node_to_stream_id; gpu_stream_util::AssignStreamsOpts opts; - ASSERT_OK(gpu_stream_util::AssignStreams(&g, opts, &node_to_stream_id)); + TF_ASSERT_OK(gpu_stream_util::AssignStreams(&g, opts, &node_to_stream_id)); // There should be 5 nodes assigned. EXPECT_EQ(5, node_to_stream_id.size()); @@ -90,12 +90,12 @@ TEST_F(GpuStreamUtilTest, SimpleGraphManyStreams) { ops::MatMul(ops::Const(Tensor(DT_FLOAT), b.opts()), ops::Const(Tensor(DT_FLOAT), b.opts()), b.opts()); Graph g(OpRegistry::Global()); - ASSERT_OK(b.ToGraph(&g)); + TF_ASSERT_OK(b.ToGraph(&g)); std::unordered_map<int, int> node_to_stream_id; gpu_stream_util::AssignStreamsOpts opts; opts.max_streams = 3; - ASSERT_OK(gpu_stream_util::AssignStreams(&g, opts, &node_to_stream_id)); + TF_ASSERT_OK(gpu_stream_util::AssignStreams(&g, opts, &node_to_stream_id)); // There should be 5 nodes assigned. EXPECT_EQ(5, node_to_stream_id.size()); @@ -115,7 +115,7 @@ TEST_F(GpuStreamUtilTest, StreamOverrides) { ops::Const(Tensor(DT_FLOAT), b.opts()), b.opts()); ops::_Send(n, "output", "/gpu:0", 0, "/cpu:0", b.opts().WithName("output")); Graph g(OpRegistry::Global()); - ASSERT_OK(b.ToGraph(&g)); + TF_ASSERT_OK(b.ToGraph(&g)); // Perform stream assignment using a large number of streams, but with // op types constrained to specific streams. @@ -126,7 +126,7 @@ TEST_F(GpuStreamUtilTest, StreamOverrides) { opts.send_stream = 91; opts.recv_stream = 92; opts.compute_stream = 93; - ASSERT_OK(gpu_stream_util::AssignStreams(&g, opts, &node_to_stream_id)); + TF_ASSERT_OK(gpu_stream_util::AssignStreams(&g, opts, &node_to_stream_id)); // There should be 7 nodes assigned. EXPECT_EQ(7, node_to_stream_id.size()); // including _SOURCE and _SINK diff --git a/tensorflow/core/common_runtime/simple_placer_test.cc b/tensorflow/core/common_runtime/simple_placer_test.cc index 00f9dfba56..14871c7a29 100644 --- a/tensorflow/core/common_runtime/simple_placer_test.cc +++ b/tensorflow/core/common_runtime/simple_placer_test.cc @@ -238,10 +238,10 @@ TEST_F(SimplePlacerTest, TestNoConstraints) { Node* input = ops::SourceOp("TestInput", b.opts().WithName("in")); ops::UnaryOp("TestRelu", ops::NodeOut(input, 0), b.opts().WithName("n1")); ops::UnaryOp("TestRelu", ops::NodeOut(input, 1), b.opts().WithName("n2")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } - EXPECT_OK(Place(&g)); + TF_EXPECT_OK(Place(&g)); EXPECT_DEVICE_TYPE(g, "in", DEVICE_CPU); EXPECT_DEVICE_TYPE(g, "n1", DEVICE_GPU); EXPECT_DEVICE_TYPE(g, "n2", DEVICE_GPU); @@ -259,10 +259,10 @@ TEST_F(SimplePlacerTest, TestDeviceTypeConstraints) { ops::BinaryOp("AssignCPU", var_cpu, input, b.opts().WithName("assign_cpu")); Node* var_gpu = ops::SourceOp("VariableGPU", b.opts().WithName("var_gpu")); ops::BinaryOp("AssignGPU", var_gpu, input, b.opts().WithName("assign_gpu")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } - EXPECT_OK(Place(&g)); + TF_EXPECT_OK(Place(&g)); EXPECT_DEVICE_TYPE(g, "in", DEVICE_CPU); EXPECT_DEVICE_TYPE(g, "var_cpu", DEVICE_CPU); EXPECT_DEVICE_TYPE(g, "assign_cpu", DEVICE_CPU); @@ -281,10 +281,10 @@ TEST_F(SimplePlacerTest, TestPartialSpec) { ops::SourceOp("TestInput", b.opts().WithName("in").WithDevice("/job:a")); ops::SourceOp("TestVariable", b.opts().WithName("var").WithDevice("/job:a")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } - EXPECT_OK(Place(&g)); + TF_EXPECT_OK(Place(&g)); EXPECT_DEVICE_TYPE(g, "in", DEVICE_CPU); EXPECT_DEVICE_CONTAINS(g, "in", "/job:a"); EXPECT_DEVICE_TYPE(g, "var", DEVICE_GPU); @@ -297,13 +297,13 @@ TEST_F(SimplePlacerTest, TestAssignedDevicePreserved) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("TestInput", b.opts().WithName("in")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } GetNodeByName(g, "in") ->set_assigned_device_name("/job:a/replica:0/task:0/cpu:7"); - EXPECT_OK(Place(&g)); + TF_EXPECT_OK(Place(&g)); EXPECT_EQ("/job:a/replica:0/task:0/cpu:7", GetNodeByName(g, "in")->assigned_device_name()); } @@ -317,12 +317,12 @@ TEST_F(SimplePlacerTest, TestPartialSpecGpuToCpu) { ops::SourceOp("TestInput", b.opts().WithName("in").WithDevice("/gpu:0")); ops::SourceOp("TestVariable", b.opts().WithName("var").WithDevice("/gpu:0")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } SessionOptions options; options.config.set_allow_soft_placement(true); - EXPECT_OK(Place(&g, &options)); + TF_EXPECT_OK(Place(&g, &options)); EXPECT_DEVICE_TYPE(g, "in", DEVICE_CPU); EXPECT_DEVICE_CONTAINS(g, "in", "/cpu"); EXPECT_DEVICE_TYPE(g, "var", DEVICE_GPU); @@ -336,7 +336,7 @@ TEST_F(SimplePlacerTest, TestAssignedGpuDeviceToCpuDevice) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("TestInput", b.opts().WithName("in")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } GetNodeByName(g, "in") @@ -369,7 +369,7 @@ Status SimplePlacerTest::ReferenceTestHelper(const string& variable_op_type, ops::BinaryOp(assign_op_type, var, input, b.opts().WithName(strings::StrCat("assign_", i))); } - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } TF_RETURN_IF_ERROR(Place(&g)); @@ -388,25 +388,25 @@ Status SimplePlacerTest::ReferenceTestHelper(const string& variable_op_type, // (unconstrained, CPU-only, and GPU-only). TEST_F(SimplePlacerTest, TestReferenceConnection) { Status s; - EXPECT_OK(ReferenceTestHelper("TestVariable", "TestAssign", DEVICE_GPU)); - EXPECT_OK(ReferenceTestHelper("TestVariable", "AssignCPU", DEVICE_CPU)); - EXPECT_OK(ReferenceTestHelper("TestVariable", "AssignGPU", DEVICE_GPU)); - EXPECT_OK(ReferenceTestHelper("VariableCPU", "TestAssign", DEVICE_CPU)); - EXPECT_OK(ReferenceTestHelper("VariableCPU", "AssignCPU", DEVICE_CPU)); + TF_EXPECT_OK(ReferenceTestHelper("TestVariable", "TestAssign", DEVICE_GPU)); + TF_EXPECT_OK(ReferenceTestHelper("TestVariable", "AssignCPU", DEVICE_CPU)); + TF_EXPECT_OK(ReferenceTestHelper("TestVariable", "AssignGPU", DEVICE_GPU)); + TF_EXPECT_OK(ReferenceTestHelper("VariableCPU", "TestAssign", DEVICE_CPU)); + TF_EXPECT_OK(ReferenceTestHelper("VariableCPU", "AssignCPU", DEVICE_CPU)); { Status s = ReferenceTestHelper("VariableCPU", "AssignGPU", DEVICE_CPU); EXPECT_EQ(error::INVALID_ARGUMENT, s.code()); EXPECT_TRUE(StringPiece(s.error_message()) .contains("no device type supports both of those nodes")); } - EXPECT_OK(ReferenceTestHelper("VariableGPU", "TestAssign", DEVICE_GPU)); + TF_EXPECT_OK(ReferenceTestHelper("VariableGPU", "TestAssign", DEVICE_GPU)); { Status s = ReferenceTestHelper("VariableGPU", "AssignCPU", DEVICE_CPU); EXPECT_EQ(error::INVALID_ARGUMENT, s.code()); EXPECT_TRUE(StringPiece(s.error_message()) .contains("no device type supports both of those nodes")); } - EXPECT_OK(ReferenceTestHelper("VariableGPU", "AssignGPU", DEVICE_GPU)); + TF_EXPECT_OK(ReferenceTestHelper("VariableGPU", "AssignGPU", DEVICE_GPU)); } // Test the handling of '@node_name' colocation constraints, when @@ -431,10 +431,10 @@ TEST_F(SimplePlacerTest, TestColocatedChain) { .WithDevice(strings::StrCat("@n_", i - 1))); } } - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } - EXPECT_OK(Place(&g)); + TF_EXPECT_OK(Place(&g)); for (int i = 0; i < 100; ++i) { if (i % 10 != 0) { EXPECT_COLOCATED(g, strings::StrCat("n_", i - (i % 1)), @@ -463,10 +463,10 @@ TEST_F(SimplePlacerTest, TestColocatedChainWithLongRangeColocations) { .WithName(strings::StrCat("n_", i)) .WithDevice(strings::StrCat("@n_", i % 10))); } - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } - EXPECT_OK(Place(&g)); + TF_EXPECT_OK(Place(&g)); for (int i = 10; i < 100; ++i) { EXPECT_COLOCATED(g, strings::StrCat("n_", i % 10), strings::StrCat("n_", i)); @@ -497,10 +497,10 @@ TEST_F(SimplePlacerTest, TestColocationAndReferenceConnections) { .WithName(strings::StrCat("assign_", i)) .WithDevice(strings::StrCat("@assign_", i % 3))); } - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } - EXPECT_OK(Place(&g)); + TF_EXPECT_OK(Place(&g)); for (int i = 0; i < 10; ++i) { EXPECT_COLOCATED(g, strings::StrCat("var_", i), strings::StrCat("assign_", i)); @@ -521,7 +521,7 @@ TEST_F(SimplePlacerTest, TestEmptyDeviceSet) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("TestInput", b.opts().WithName("in")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } DeviceSet empty; @@ -541,7 +541,7 @@ TEST_F(SimplePlacerTest, TestHeterogeneousDeviceSetFailure) { Node* var = ops::SourceOp("VariableGPU", b.opts().WithName("var")); ops::BinaryOp("TestAssign", var, in, b.opts().WithName("assign").WithDevice("/job:b/task:1")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } DeviceSet heterogeneous; @@ -564,7 +564,7 @@ TEST_F(SimplePlacerTest, TestUnknownDevice) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("TestInput", b.opts().WithName("in").WithDevice("/job:foo")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } Status s = Place(&g); @@ -582,7 +582,7 @@ TEST_F(SimplePlacerTest, TestUnknownMergedDevice) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("TestInput", b.opts().WithName("in").WithDevice("/job:foo")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } Status s = Place(&g); @@ -600,7 +600,7 @@ TEST_F(SimplePlacerTest, TestUnknownAssignedDevice) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("TestInput", b.opts().WithName("in")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } GetNodeByName(g, "in")->set_assigned_device_name("/job:foo"); @@ -619,7 +619,7 @@ TEST_F(SimplePlacerTest, TestNoKernelsRegistered) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("VariableNoKernels", b.opts().WithName("var")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } Status s = Place(&g); @@ -637,7 +637,7 @@ TEST_F(SimplePlacerTest, TestNoDevicesRegistered) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("VariableGPU", b.opts().WithName("var")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } DeviceSet cpu_only; @@ -658,7 +658,7 @@ TEST_F(SimplePlacerTest, TestMalformedDeviceSpecification) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("TestInput", b.opts().WithName("in").WithDevice("/foo:bar")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } Status s = Place(&g); @@ -673,7 +673,7 @@ TEST_F(SimplePlacerTest, TestMalformedAssignedDevice) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("TestInput", b.opts().WithName("in")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } GetNodeByName(g, "in")->set_assigned_device_name("/foo:bar"); @@ -691,7 +691,7 @@ TEST_F(SimplePlacerTest, TestNonUniqueAssignedDevice) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("TestInput", b.opts().WithName("in")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } GetNodeByName(g, "in")->set_assigned_device_name("/job:a"); @@ -710,7 +710,7 @@ TEST_F(SimplePlacerTest, TestUnknownColocatedNode) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("TestInput", b.opts().WithName("in").WithDevice("@foo")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } Status s = Place(&g); @@ -725,7 +725,7 @@ TEST_F(SimplePlacerTest, TestMalformedColocatedNode) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("TestInput", b.opts().WithName("in").WithDevice("@")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } Status s = Place(&g); @@ -741,12 +741,12 @@ TEST_F(SimplePlacerTest, TestNonexistentGpuAllowSoftPlacement) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("TestDevice", b.opts().WithName("in").WithDevice("/gpu:11")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } SessionOptions options; options.config.set_allow_soft_placement(true); - EXPECT_OK(Place(&g, &options)); + TF_EXPECT_OK(Place(&g, &options)); EXPECT_DEVICE_CONTAINS(g, "in", "/gpu:0"); } @@ -757,7 +757,7 @@ TEST_F(SimplePlacerTest, TestNonexistentGpuNoAllowSoftPlacement) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("TestDevice", b.opts().WithName("in").WithDevice("/gpu:11")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } SessionOptions options; @@ -776,7 +776,7 @@ TEST_F(SimplePlacerTest, TestUnsupportedDeviceNoAllowSoftPlacement) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("VariableGPU", b.opts().WithName("var").WithDevice("/cpu:0")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } SessionOptions options; @@ -793,12 +793,12 @@ TEST_F(SimplePlacerTest, TestUnsupportedDeviceAllowSoftPlacement) { { // Scope for temporary variables used to construct g. GraphDefBuilder b(GraphDefBuilder::kFailImmediately); ops::SourceOp("VariableGPU", b.opts().WithName("var").WithDevice("/cpu:0")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } SessionOptions options; options.config.set_allow_soft_placement(true); - EXPECT_OK(Place(&g, &options)); + TF_EXPECT_OK(Place(&g, &options)); } // Test that a graph with device type and reference constraints on @@ -820,12 +820,12 @@ TEST_F(SimplePlacerTest, TestDeviceTypeConstraintsAllowSoftPlacement) { Node* var_cpu = ops::SourceOp("VariableCPU", b.opts().WithName("var_cpu")); ops::UnaryOp("TestDeviceEnforce", var_cpu, b.opts().WithName("force_cpu").WithDevice("/gpu:0")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } SessionOptions options; options.config.set_allow_soft_placement(true); - EXPECT_OK(Place(&g, &options)); + TF_EXPECT_OK(Place(&g, &options)); EXPECT_DEVICE_TYPE(g, "var_gpu", DEVICE_GPU); EXPECT_DEVICE_TYPE(g, "force_gpu", DEVICE_GPU); EXPECT_COLOCATED(g, "var_gpu", "force_gpu"); @@ -843,7 +843,7 @@ TEST_F(SimplePlacerTest, TestUnsatisfiableConstraintWithReferenceConnections) { Node* var = ops::SourceOp("VariableGPU", b.opts().WithName("var")); Node* input = ops::SourceOp("TestInput", b.opts().WithName("in")); ops::BinaryOp("AssignCPU", var, input, b.opts().WithName("assign")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } Status s = Place(&g); @@ -865,7 +865,7 @@ TEST_F(SimplePlacerTest, TestUnsatisfiableConstraintWithColocatedNodes) { b.opts().WithName("relu_1").WithDevice("@in")); ops::UnaryOp("ReluGPU", relu_1, b.opts().WithName("relu_2").WithDevice("@relu_1")); - EXPECT_OK(BuildGraph(b, &g)); + TF_EXPECT_OK(BuildGraph(b, &g)); } Status s = Place(&g); |