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

trunk/9186b190a054d20bb060de831eb04008f55c61fd: [CUDA] Fix arange overflow for N >= 2**32 (#197713)

图:PyTorch Releases

发生了什么

Fixes #197673 block_work_size * blockIdx.x in elementwise_kernel_with_index is int * unsigned int , so it's computed in 32 bits and wraps before widening to index_t . For N >= 2**32, threads meant for index 2**32 + k write to index k instead, and the tail is never written. The fix casts to index_t before multiplying. This affects arange, range, linspace and logspace, since they share this helper. Test: the >2**32 ca…

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

为什么在扩散

来源