MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / hash

Method hash

src/core/impl/graph/operator_node.cpp:177–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177size_t OperatorNodeBase::hash() const {
178 XXHash hstate;
179 hstate.update(m_input.data(), sizeof(m_input[0]) * m_input.size());
180 size_t extra_size = 2 + m_config.comp_node().size() + m_extra_equiv_comp.size(),
181 next = 0, extra[extra_size];
182
183 // type info
184 extra[next++] = mgb::hash(dyn_typeinfo());
185
186 // config
187 extra[next++] = m_config.hash();
188 for (auto i : m_config.comp_node())
189 extra[next++] = mgb::hash(i);
190
191 // extra
192 for (const HashableContainer& i : m_extra_equiv_comp)
193 extra[next++] = mgb::hash(i);
194
195 mgb_assert(next == extra_size);
196 hstate.update(extra, sizeof(extra[0]) * extra_size);
197 return hstate.digest();
198}
199
200bool OperatorNodeBase::is_same_st(const Hashable& rhs_) const {
201 auto&& rhs = static_cast<const OperatorNodeBase&>(rhs_);

Callers 2

insert_preMethod · 0.45
insert_postMethod · 0.45

Calls 8

hashFunction · 0.50
hash_pair_combineFunction · 0.50
updateMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
comp_nodeMethod · 0.45
digestMethod · 0.45
handleMethod · 0.45

Tested by

no test coverage detected