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

Function hash

imperative/src/impl/ops/custom_opdef.cpp:216–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216size_t hash(const OpDef& def) {
217 auto&& op = static_cast<const CustomOpDef&>(def);
218 const custom::Param& param = op.param();
219 size_t val = mgb::hash(op.runtime_id());
220 std::string hash_str = "";
221 for (auto&& val : param.raw()) {
222 hash_str += val.first;
223 hash_str += val.second.str();
224 }
225
226 val = mgb::hash_pair_combine(val, mgb::hash(hash_str));
227 return val;
228}
229
230bool is_same_st(const OpDef& lhs, const OpDef& rhs) {
231 auto &&a = static_cast<const CustomOpDef&>(lhs),

Callers

nothing calls this directly

Calls 4

hash_pair_combineFunction · 0.50
paramMethod · 0.45
runtime_idMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected