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

Method insert

src/custom/impl/manager.cpp:106–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106std::shared_ptr<CustomOp> CustomOpManager::insert(
107 const std::string& name, uint32_t version) {
108 MGB_LOCK_GUARD(m_op_mtx);
109 auto iter = m_name2op.find(name);
110 if (iter != m_name2op.end()) {
111 mgb_log_warn(
112 "Register Custom Op Failed! Op %s has been registered", name.c_str());
113 return std::const_pointer_cast<CustomOp, const CustomOp>(iter->second);
114 }
115 std::shared_ptr<const CustomOp> op =
116 std::make_shared<const CustomOp>(name, version);
117 m_name2op[op->op_type()] = op;
118 m_id2op[op->runtime_id()] = op;
119 return std::const_pointer_cast<CustomOp, const CustomOp>(op);
120}
121
122bool CustomOpManager::erase(const std::string& name) {
123 MGB_LOCK_GUARD(m_op_mtx);

Callers 15

build_infoMethod · 0.45
parse_jsonMethod · 0.45
parse_imageMethod · 0.45
parse_npyMethod · 0.45
parse_stringMethod · 0.45
parse_shapeMethod · 0.45
parse_objectMethod · 0.45
utils.cppFile · 0.45
NormalStrategyMethod · 0.45
initMethod · 0.45

Calls 4

findMethod · 0.45
endMethod · 0.45
op_typeMethod · 0.45
runtime_idMethod · 0.45

Tested by 12

TESTFunction · 0.36
expand_elem_chainFunction · 0.36
TESTFunction · 0.36
make_detMethod · 0.36
TEST_PASSFunction · 0.36
TESTFunction · 0.36
get_rev_topo_orderMethod · 0.36
ensure_init_graphMethod · 0.36
check_waiting_specFunction · 0.36
TESTFunction · 0.36
runMethod · 0.36