#4901·MNN

在创建推理会话时,模型张量名进入默认哈希表可能会导致 CPU 发生哈希碰撞。

作者: K-ANOY创建于 2026年9月22日更新于 2026年9月29日
标签type:performancestatus:needs-info

When MNN creates an inference session through the Interpreter's Session API, it batches the **tensor names** in the model file into a `std::unordered_map` using the default string hash. If the application accepts models from untrusted sources, the file provider can control this batch of keys. In a target build where the string hash and bucketing behavior are predictable, if a large number of different names form a long bucket chain during the actual table creation, it may cause significant CPU overhead for the inference session creation.