1 #include <ATen/core/Dict.h> 2 3 4 namespace c10::detail { operator ==(const DictImpl & lhs,const DictImpl & rhs)5bool operator==(const DictImpl& lhs, const DictImpl& rhs) { 6 bool isEqualFastChecks = 7 *lhs.elementTypes.keyType == *rhs.elementTypes.keyType && 8 *lhs.elementTypes.valueType == *rhs.elementTypes.valueType && 9 lhs.dict.size() == rhs.dict.size(); 10 if (!isEqualFastChecks) { 11 return false; 12 } 13 14 // Dict equality should not care about ordering. 15 for (const auto& pr : lhs.dict) { 16 auto it = rhs.dict.find(pr.first); 17 if (it == rhs.dict.cend()) { 18 return false; 19 } 20 // see: [container equality] 21 if (!_fastEqualsForContainer(it->second, pr.second)) { 22 return false; 23 } 24 } 25 26 return true; 27 } 28 } // namespace c10::detail 29