diff --git a/tensorflow/compiler/jit/encapsulate_xla_computations_pass.cc b/tensorflow/compiler/jit/encapsulate_xla_computations_pass.cc index 4a5c79c02d9..9e209f3342e 100644 --- a/tensorflow/compiler/jit/encapsulate_xla_computations_pass.cc +++ b/tensorflow/compiler/jit/encapsulate_xla_computations_pass.cc @@ -43,7 +43,7 @@ bool IsCpuGpuCompile(const Graph* graph) { for (Node* n : graph->nodes()) { string name; // Only consider nodes being compiled. - if (!GetNodeAttr(n->attrs(), kXlaClusterIdAttr, &name).ok()) continue; + if (!TryGetNodeAttr(n->attrs(), kXlaClusterIdAttr, &name)) continue; // Early return for any node with a device that is not a CPU or GPU. DeviceNameUtils::ParsedName parsed; if (DeviceNameUtils::ParseFullName(n->requested_device(), &parsed)) { @@ -58,8 +58,8 @@ bool IsCpuGpuCompile(const Graph* graph) { // Checks if a graph node is marked to be a guaranteed constant. bool is_guaranteed_constant(const Node& n) { bool guaranteed_constant = false; - if (!GetNodeAttr(n.attrs(), "_is_guaranteed_constant", &guaranteed_constant) - .ok()) { + if (!TryGetNodeAttr(n.attrs(), "_is_guaranteed_constant", + &guaranteed_constant)) { return false; } return guaranteed_constant; diff --git a/tensorflow/compiler/tf2xla/xla_op_registry.cc b/tensorflow/compiler/tf2xla/xla_op_registry.cc index 36db01b8df5..d5cc9550649 100644 --- a/tensorflow/compiler/tf2xla/xla_op_registry.cc +++ b/tensorflow/compiler/tf2xla/xla_op_registry.cc @@ -397,9 +397,8 @@ XlaOpRegistry::CompileTimeConstantInputArgNames(const string& op) { const std::unordered_set<string>* compile_time_constant_inputs; - if (GetNodeAttr(node_def, kXlaCompileTimeConstantInputsAttr, - &compile_time_constant_inputs_vect_from_attr) - .ok()) { + if (TryGetNodeAttr(node_def, kXlaCompileTimeConstantInputsAttr, + &compile_time_constant_inputs_vect_from_attr)) { absl::c_copy(compile_time_constant_inputs_vect_from_attr, std::inserter(compile_time_constant_inputs_from_attr, compile_time_constant_inputs_from_attr.end()));