(path: str)
| 35 | |
| 36 | |
| 37 | def load_tensor(path: str) -> torch.Tensor: |
| 38 | with open(path + ".shape", "r", encoding="utf-8") as f: |
| 39 | shape = [int(x) for x in f.read().strip().split(",") if x] |
| 40 | data = np.fromfile(path + ".bin", dtype=np.float32).reshape(shape) |
| 41 | return torch.from_numpy(data) |
| 42 | |
| 43 | |
| 44 | def save_raw(path: str, arr: np.ndarray, shape) -> None: |