(path: str, arr: np.ndarray, shape)
| 65 | |
| 66 | |
| 67 | def save_raw(path: str, arr: np.ndarray, shape) -> None: |
| 68 | os.makedirs(os.path.dirname(path) or ".", exist_ok=True) |
| 69 | with open(path + ".bin", "wb") as f: |
| 70 | f.write(arr.astype(np.float32, copy=False).tobytes()) |
| 71 | with open(path + ".shape", "w", encoding="utf-8") as f: |
| 72 | f.write(",".join(str(int(d)) for d in shape)) |
| 73 | |
| 74 | |
| 75 | def save_tensor(path: str, t: torch.Tensor) -> None: |
no outgoing calls
no test coverage detected