(tensor, name, path)
| 8 | np.save(pathlib.Path(path, f'{name}.npy'), s) |
| 9 | |
| 10 | def save_tensor(tensor, name, path): |
| 11 | tensor_numpy = tensor.numpy() |
| 12 | tensor_dims = np.array(tensor_numpy.shape) |
| 13 | tensor_values = tensor_numpy.flatten() |
| 14 | tensor_to_save = np.concatenate((tensor_dims, tensor_values)).astype(np.float32) |
| 15 | np.save(pathlib.Path(path, f'{name}.npy'), tensor_to_save) |
| 16 | |
| 17 | def save_linear(linear, path): |
| 18 | pathlib.Path(path).mkdir(parents=True, exist_ok=True) |
no outgoing calls
no test coverage detected