Download utils/nn/init.py from sanganaka/SanDP: direct link, hf CLI and curl.
- Browser
- Download file 345 Bytes
-
https://huggingface.co/sanganaka/SanDP/resolve/main/utils/nn/init.py
- Command line
-
hf download hf://sanganaka/SanDP/utils/nn/init.py
-
curl -L -o init.py https://huggingface.co/sanganaka/SanDP/resolve/main/utils/nn/init.py
345 Bytes
| def assign_tensor(tensor, val): | |
| """ | |
| copy val to tensor | |
| Args: | |
| tensor: an n-dimensional torch.Tensor | |
| val: an n-dimensional torch.Tensor to fill the tensor with | |
| Returns: | |
| """ | |
| #if isinstance(tensor, Variable): | |
| # assign_tensor(tensor.data, val) | |
| # return tensor | |
| return tensor.data.copy_(val) | |