aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/cc/framework
diff options
context:
space:
mode:
authorGravatar Geoffrey Irving <geoffreyi@google.com>2017-05-17 09:23:54 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-05-17 09:27:36 -0700
commit73882f257ffb1bc9e1a828571c085d080b1d9266 (patch)
tree8adcefa226f95d6c6ce067ee45528d76794e55fb /tensorflow/cc/framework
parent9a47c258c9c2286ae2c14a0da6458055f3b691d3 (diff)
Automated g4 rollback of changelist 156251356
PiperOrigin-RevId: 156315860
Diffstat (limited to 'tensorflow/cc/framework')
-rw-r--r--tensorflow/cc/framework/cc_op_gen.cc9
-rw-r--r--tensorflow/cc/framework/cc_ops_test.cc17
-rw-r--r--tensorflow/cc/framework/scope.cc4
3 files changed, 14 insertions, 16 deletions
diff --git a/tensorflow/cc/framework/cc_op_gen.cc b/tensorflow/cc/framework/cc_op_gen.cc
index 799492a4eb..71aa986f91 100644
--- a/tensorflow/cc/framework/cc_op_gen.cc
+++ b/tensorflow/cc/framework/cc_op_gen.cc
@@ -740,11 +740,10 @@ void OpInfo::GetOutput(string* out) const {
return;
}
strings::StrAppend(out, " ::tensorflow::NameRangeMap _outputs_range;\n");
- strings::StrAppend(
- out,
- " ::tensorflow::Status _status_ = "
- "::tensorflow::NameRangesForNode(ret->def(), ret->op_def(), "
- "nullptr, &_outputs_range);\n");
+ strings::StrAppend(out,
+ " ::tensorflow::Status _status_ = "
+ "::tensorflow::NameRangesForNode(*ret, 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 92c97d107d..5da23036ea 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()->def(), kColocationAttrName, constraints));
+ TF_EXPECT_OK(GetNodeAttr(tensor.op().node()->attrs(), 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());
- 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");
+ 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");
}
TEST(CCOpTest, ColocateWith) {
@@ -190,8 +190,7 @@ TEST(CCOpTest, ColocateWith) {
Scope with_colocate = root.ColocateWith(c3).ColocateWith(c4);
auto c6 = Const(with_colocate.WithOpName("c6").ClearColocation(), 7);
- const auto& attrs = c6.op().node()->def().attr();
- EXPECT_TRUE(attrs.find("_class") == attrs.end());
+ EXPECT_FALSE(c6.op().node()->attrs().Find("_class"));
}
TEST(CCOpTest, TemplatedConst) {
diff --git a/tensorflow/cc/framework/scope.cc b/tensorflow/cc/framework/scope.cc
index 8b7fc1406f..32c0822de6 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 NodeDef& node_def = colocate_with_op.node()->def();
+ const AttrSlice attrs = colocate_with_op.node()->attrs();
std::vector<string> node_constraints;
- if (GetNodeAttr(node_def, kColocationAttrName, &node_constraints).ok()) {
+ if (GetNodeAttr(attrs, kColocationAttrName, &node_constraints).ok()) {
for (const string& entry : node_constraints) {
StringPiece s(entry);
if (s.Consume(kColocationGroupPrefix)) {