| 120 | } |
| 121 | |
| 122 | bool CustomOpManager::erase(const std::string& name) { |
| 123 | MGB_LOCK_GUARD(m_op_mtx); |
| 124 | auto iter = m_name2op.find(name); |
| 125 | if (iter == m_name2op.end()) { |
| 126 | mgb_log_warn( |
| 127 | "Erase Custom Op Failed! %s has not been registered", name.c_str()); |
| 128 | return false; |
| 129 | } |
| 130 | std::shared_ptr<const CustomOp> op = iter->second; |
| 131 | m_id2op.erase(op->runtime_id()); |
| 132 | m_name2op.erase(op->op_type()); |
| 133 | return true; |
| 134 | } |
| 135 | |
| 136 | RunTimeId CustomOpManager::to_id(const std::string& name) const { |
| 137 | std::shared_ptr<const CustomOp> op = find(name); |