Download SpecForge/tests/test_utils/utils.py from FasterDFlash/Hanrui: direct link, hf CLI and curl.
- Browser
- Download file 227 Bytes
-
https://huggingface.co/FasterDFlash/Hanrui/resolve/main/SpecForge/tests/test_utils/utils.py
- Command line
-
hf download hf://FasterDFlash/Hanrui/SpecForge/tests/test_utils/utils.py
-
curl -L -o utils.py https://huggingface.co/FasterDFlash/Hanrui/resolve/main/SpecForge/tests/test_utils/utils.py
227 Bytes
| import torch | |
| import torch.nn.init | |
| def norm_tensor(shape, device, dtype, std=0.02): | |
| t = torch.empty(shape, device=device, dtype=dtype, requires_grad=True) | |
| torch.nn.init.trunc_normal_(t, mean=0.0, std=std) | |
| return t | |