| 816 | } |
| 817 | |
| 818 | uint64 RepeatedAttrDefHash( |
| 819 | const protobuf::RepeatedPtrField<OpDef::AttrDef>& a) { |
| 820 | // Insert AttrDefs into map to deterministically sort by name |
| 821 | std::map<string, const OpDef::AttrDef*> a_set; |
| 822 | for (const OpDef::AttrDef& def : a) { |
| 823 | a_set[def.name()] = &def; |
| 824 | } |
| 825 | // Iterate and combines hashes of keys and values |
| 826 | uint64 h = 0xDECAFCAFFE; |
| 827 | for (const auto& pair : a_set) { |
| 828 | h = Hash64(pair.first.data(), pair.first.size(), h); |
| 829 | h = Hash64Combine(AttrDefHash(*pair.second), h); |
| 830 | } |
| 831 | return h; |
| 832 | } |
| 833 | |
| 834 | bool OpDefEqual(const OpDef& o1, const OpDef& o2) { |
| 835 | // attr order doesn't matter. |