← 返回事件
持续讨论AI发版

viable/strict/1788641405: Fix iterator validity check order in validate_allocation_plan (#196107)

图:PyTorch Releases

发生了什么

In validate_allocation_plan, when processing a Free event, the code dereferenced the iterator returned by allocations.find() before checking whether the iterator was valid (i.e., not equal to allocations.end()). This causes undefined behavior when the allocation plan is invalid and a free event does not have a matching allocate event. Fix by moving the it != allocations.end() TORCH_CHECK before the dereference. "Enf…

摘要按规则整理自下方来源原文

为什么在扩散

来源