| 211 | } |
| 212 | |
| 213 | bool AttrSlice::EqualAttrs(AttrSlice other, Scratch* scratch) const { |
| 214 | if (size() != other.size()) return false; |
| 215 | |
| 216 | for (const auto& attr : *other.attrs_) { |
| 217 | auto iter = attrs_->find(attr.first); |
| 218 | if (iter == attrs_->end()) return false; |
| 219 | // TODO(irving): Comparing AttrValues by proto is slightly buggy, since |
| 220 | // TensorProto is a nonunique representation of Tensor. This bug will go |
| 221 | // away once AttrSlice switches over to NodeInfo. |
| 222 | iter->second.SerializeToString(&scratch->a); |
| 223 | attr.second.SerializeToString(&scratch->b); |
| 224 | if (scratch->a != scratch->b) return false; |
| 225 | } |
| 226 | return true; |
| 227 | } |
| 228 | |
| 229 | // The ... is to allow the caller to inject some value validation code. Use |
| 230 | // just ; if no additional validation code is needed. |
no test coverage detected