viable/strict/1788641405: Fix iterator validity check order in validate_allocation_plan (#196107)
- PyTorch 近 90 天出现 575 次
- PyTorch 近 90 天第 569 次发版
- 上一次:同一天稍早 · viable/strict/1788623399
发生了什么
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…
摘要按规则整理自下方来源原文