Download code/aio/sim/model.py from M3rcyzzz/AIO1: direct link, hf CLI and curl.
- Browser
- Download file 857 Bytes
-
https://huggingface.co/M3rcyzzz/AIO1/resolve/main/code/aio/sim/model.py
- Command line
-
hf download hf://M3rcyzzz/AIO1/code/aio/sim/model.py
-
curl -L -o model.py https://huggingface.co/M3rcyzzz/AIO1/resolve/main/code/aio/sim/model.py
857 Bytes
| import math | |
| import torch | |
| from aio import interface as IF | |
| from aio.sim.prior import hprime, phi_of, sizes, nzmax, DMAX | |
| LAGS = 240 | |
| P_DMC, M_DMC, LAM_DMC = (240, 8, 3.0) | |
| MT = (0, 1, 3, 6, 10, 16, 26, 42) | |
| LAM_REL = 0.02 | |
| LOAD_SUPP = 30.0 | |
| LAB_LAGS = (1, 2, 4, 8, 16, 32, 64, 128, 240) | |
| NLAB = len(LAB_LAGS) | |
| KNOTS = {NLAB: LAB_LAGS, 16: (1, 2, 3, 4, 6, 8, 11, 16, 23, 32, 45, 64, 90, 128, 181, 240)} | |
| NZMAX = 4 | |
| NR = IF.NMV + NZMAX | |
| ZL = (4, 8, 16, 32, 64, 128, 240) | |
| ZDT = (6.0, 6.0, 12.0, 24.0, 48.0, 88.0, 56.0) | |
| LU_MAX = 64 | |
| def spd_solve(H, G): | |
| if H.shape[-1] <= LU_MAX: | |
| return torch.linalg.solve_ex(H, G)[0].nan_to_num(0.0, 0.0, 0.0) | |
| L, info = torch.linalg.cholesky_ex(H) | |
| X = torch.cholesky_solve(G, L) | |
| for i in map(tuple, info.nonzero().tolist()): | |
| X[i] = torch.linalg.solve_ex(H[i], G[i])[0] | |
| return X.nan_to_num(0.0, 0.0, 0.0) | |