diff options
author | Geoffrey Irving <geoffreyi@google.com> | 2017-05-16 17:01:31 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-05-16 17:05:15 -0700 |
commit | 43db5c623f748b6f9704e9e9be5a5a11fa2a4c1a (patch) | |
tree | 985844ec8f6653f36e38592f9700dcaba66d94f2 /tensorflow/cc/framework | |
parent | 7ab0c2eff12ea79648f6717dae8558d6669e5c27 (diff) |
Automated g4 rollback of changelist 156244933
PiperOrigin-RevId: 156251356
Diffstat (limited to 'tensorflow/cc/framework')
-rw-r--r-- | tensorflow/cc/framework/cc_op_gen.cc | 9 | ||||
-rw-r--r-- | tensorflow/cc/framework/cc_ops_test.cc | 17 | ||||
-rw-r--r-- | tensorflow/cc/framework/scope.cc | 4 |
3 files changed, 16 insertions, 14 deletions
diff --git a/tensorflow/cc/framework/cc_op_gen.cc b/tensorflow/cc/framework/cc_op_gen.cc index 71aa986f91..799492a4eb 100644 --- a/tensorflow/cc/framework/cc_op_gen.cc +++ b/tensorflow/cc/framework/cc_op_gen.cc @@ -740,10 +740,11 @@ void OpInfo::GetOutput(string* out) const { return; } strings::StrAppend(out, " ::tensorflow::NameRangeMap _outputs_range;\n"); - strings::StrAppend(out, - " ::tensorflow::Status _status_ = " - "::tensorflow::NameRangesForNode(*ret, ret->op_def(), " - "nullptr, &_outputs_range);\n"); + strings::StrAppend( + out, + " ::tensorflow::Status _status_ = " + "::tensorflow::NameRangesForNode(ret->def(), ret->op_def(), " + "nullptr, &_outputs_range);\n"); strings::StrAppend(out, " if (!_status_.ok()) {\n", " ", scope_str, ".UpdateStatus(_status_);\n", " return;\n"); strings::StrAppend(out, " }\n\n"); diff --git a/tensorflow/cc/framework/cc_ops_test.cc b/tensorflow/cc/framework/cc_ops_test.cc index 5da23036ea..92c97d107d 100644 --- a/tensorflow/cc/framework/cc_ops_test.cc +++ b/tensorflow/cc/framework/cc_ops_test.cc @@ -35,8 +35,8 @@ Output Linear(const Scope& scope, Input x, Input w, Input b) { void GetColocationConstraints(const Output& tensor, std::vector<string>* constraints) { constraints->clear(); - TF_EXPECT_OK(GetNodeAttr(tensor.op().node()->attrs(), kColocationAttrName, - constraints)); + TF_EXPECT_OK( + GetNodeAttr(tensor.op().node()->def(), kColocationAttrName, constraints)); } } // namespace @@ -159,11 +159,11 @@ TEST(CCOpTest, KernelLabel) { Scope root = Scope::NewRootScope(); auto add = Add(root.WithKernelLabel("AddWithKernelLabel"), 1.0f, 2.0f); TF_EXPECT_OK(root.status()); - AttrSlice attrs = add.z.op().node()->attrs(); - const auto* kernel_attr = attrs.Find("_kernel"); - ASSERT_TRUE(kernel_attr); - TF_EXPECT_OK(AttrValueHasType(*kernel_attr, "string")); - EXPECT_EQ(kernel_attr->s(), "AddWithKernelLabel"); + const auto& attrs = add.z.op().node()->def().attr(); + ASSERT_TRUE(attrs.find("_kernel") != attrs.end()); + auto kernel_attr = attrs.find("_kernel")->second; + TF_EXPECT_OK(AttrValueHasType(kernel_attr, "string")); + EXPECT_EQ(kernel_attr.s(), "AddWithKernelLabel"); } TEST(CCOpTest, ColocateWith) { @@ -190,7 +190,8 @@ TEST(CCOpTest, ColocateWith) { Scope with_colocate = root.ColocateWith(c3).ColocateWith(c4); auto c6 = Const(with_colocate.WithOpName("c6").ClearColocation(), 7); - EXPECT_FALSE(c6.op().node()->attrs().Find("_class")); + const auto& attrs = c6.op().node()->def().attr(); + EXPECT_TRUE(attrs.find("_class") == attrs.end()); } TEST(CCOpTest, TemplatedConst) { diff --git a/tensorflow/cc/framework/scope.cc b/tensorflow/cc/framework/scope.cc index 32c0822de6..8b7fc1406f 100644 --- a/tensorflow/cc/framework/scope.cc +++ b/tensorflow/cc/framework/scope.cc @@ -271,9 +271,9 @@ Scope::Impl::Impl(const Scope& other, Tags::Colocate, std::unordered_set<string> Scope::Impl::GetColocationConstraints( const Operation& colocate_with_op) const { std::unordered_set<string> current_constraints(colocation_constraints_); - const AttrSlice attrs = colocate_with_op.node()->attrs(); + const NodeDef& node_def = colocate_with_op.node()->def(); std::vector<string> node_constraints; - if (GetNodeAttr(attrs, kColocationAttrName, &node_constraints).ok()) { + if (GetNodeAttr(node_def, kColocationAttrName, &node_constraints).ok()) { for (const string& entry : node_constraints) { StringPiece s(entry); if (s.Consume(kColocationGroupPrefix)) { |