imgs: (N, 1, num_voxels) x: (N, L, patch_size)
(imgs, patch_size)
| 101 | print(f'Model loaded with {checkpoint_path}') |
| 102 | |
| 103 | def patchify(imgs, patch_size): |
| 104 | """ |
| 105 | imgs: (N, 1, num_voxels) |
| 106 | x: (N, L, patch_size) |
| 107 | """ |
| 108 | p = patch_size |
| 109 | assert imgs.ndim == 3 and imgs.shape[2] % p == 0 |
| 110 | |
| 111 | h = imgs.shape[2] // p |
| 112 | x = imgs.reshape(shape=(imgs.shape[0], h, p)) |
| 113 | return x |
| 114 | |
| 115 | def unpatchify(x, patch_size): |
| 116 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected