viable/strict/1792698655: Fix GradScaler defaulting to CUDA on non-CUDA accelerators (#196195)
- PyTorch 近 90 天出现 2676 次
- PyTorch 近 90 天第 2634 次发版
- 上一次:同一天稍早 · trunk/192c546ac13da09d009b31ef0468ec64275863e6: [CI] Introduce macOS 27 for binary builds and MPS tests (#196384)
发生了什么
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…
摘要按规则整理自下方来源原文