note: torch.zeros -> torch.empty (#13807)

* note: torch.zeros -> torch.empty

* move to gotchas.
This commit is contained in:
Sayak Paul
2026-05-26 10:37:33 +05:30
committed by GitHub
parent 3bc3e525fc
commit fdc6310f67

View File

@@ -172,3 +172,5 @@ Boolean gate. If `False` (default), calling that method raises `ValueError`. All
freqs_dtype = torch.float32 if (is_mps or is_npu) else torch.float64
```
See `transformer_flux.py`, `transformer_flux2.py`, `transformer_wan.py`, `unet_2d_condition.py` for reference usages. Never leave an unconditional `torch.float64` in the model.
6. **Using `torch.empty`.** - Do not use `torch.empty` to initialize parameters. Use `torch.zeros` or `torch.ones`, instead.