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

viable/strict/1792698655: Fix GradScaler defaulting to CUDA on non-CUDA accelerators (#196195)

发生了什么

Summary GradScaler.__init__ defaulted device to the literal string "cuda" . The rest of the class is device-generic: the scale tensor is created lazily on the device of the tensors passed to scale() , and self._device is only used to (a) gate a CUDA-availability check and (b) validate a user-supplied new_scale tensor's device. The first use is the bug. On an XPU or MPS build without CUDA, GradScaler() keeps self._de…

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

为什么在扩散

来源