| 766 | } |
| 767 | |
| 768 | bool AttrDefEqual(const OpDef::AttrDef& a1, const OpDef::AttrDef& a2) { |
| 769 | #ifndef TENSORFLOW_LITE_PROTOS |
| 770 | DCHECK_EQ(7, a1.GetDescriptor()->field_count()) |
| 771 | << "Please modify these equality and hash functions to reflect the " |
| 772 | "changes to the AttrDef protobuf"; |
| 773 | #endif // TENSORFLOW_LITE_PROTOS |
| 774 | |
| 775 | if (a1.name() != a2.name()) return false; |
| 776 | if (a1.type() != a2.type()) return false; |
| 777 | if (a1.description() != a2.description()) return false; |
| 778 | if (a1.has_minimum() != a2.has_minimum()) return false; |
| 779 | if (a1.has_minimum() && a1.minimum() != a2.minimum()) return false; |
| 780 | if (!AreAttrValuesEqual(a1.default_value(), a2.default_value())) return false; |
| 781 | if (!AreAttrValuesEqual(a1.allowed_values(), a2.allowed_values())) |
| 782 | return false; |
| 783 | return true; |
| 784 | } |
| 785 | |
| 786 | uint64 AttrDefHash(const OpDef::AttrDef& a) { |
| 787 | uint64 h = Hash64(a.name()); |