| 268 | disable_shape_inference_(other.impl()->disable_shape_inference_) {} |
| 269 | |
| 270 | std::unordered_set<string> Scope::Impl::GetColocationConstraints( |
| 271 | const Operation& colocate_with_op) const { |
| 272 | std::unordered_set<string> current_constraints(colocation_constraints_); |
| 273 | const AttrSlice attrs = colocate_with_op.node()->attrs(); |
| 274 | std::vector<string> node_constraints; |
| 275 | if (TryGetNodeAttr(attrs, kColocationAttrName, &node_constraints)) { |
| 276 | for (const string& entry : node_constraints) { |
| 277 | StringPiece s(entry); |
| 278 | if (absl::ConsumePrefix(&s, kColocationGroupPrefix)) { |
| 279 | current_constraints.emplace(s); |
| 280 | } |
| 281 | } |
| 282 | } else { |
| 283 | current_constraints.insert(colocate_with_op.node()->name()); |
| 284 | } |
| 285 | return current_constraints; |
| 286 | } |
| 287 | |
| 288 | bool Scope::ok() const { return impl()->status_->ok(); } |
| 289 | |