packbits, CUDA implementation Pack up the density grid into a bit field to accelerate ray marching. Args: grid: float, [C, H * H * H], assume H % 2 == 0 thresh: float, threshold Returns: bitfield: uint8, [C, H * H * H / 8]
(ctx, grid, thresh, bitfield=None)
| 142 | @staticmethod |
| 143 | @custom_fwd(cast_inputs=torch.float32) |
| 144 | def forward(ctx, grid, thresh, bitfield=None): |
| 145 | ''' packbits, CUDA implementation |
| 146 | Pack up the density grid into a bit field to accelerate ray marching. |
| 147 | Args: |
| 148 | grid: float, [C, H * H * H], assume H % 2 == 0 |
| 149 | thresh: float, threshold |
| 150 | Returns: |
| 151 | bitfield: uint8, [C, H * H * H / 8] |
| 152 | ''' |
| 153 | if not grid.is_cuda: grid = grid.cuda() |
| 154 | grid = grid.contiguous() |
| 155 | |
| 156 | C = grid.shape[0] |
| 157 | H3 = grid.shape[1] |
| 158 | N = C * H3 // 8 |
| 159 | |
| 160 | if bitfield is None: |
| 161 | bitfield = torch.empty(N, dtype=torch.uint8, device=grid.device) |
| 162 | |
| 163 | get_backend().packbits(grid, N, thresh, bitfield) |
| 164 | |
| 165 | return bitfield |
| 166 | |
| 167 | packbits = _packbits.apply |
| 168 |
nothing calls this directly
no test coverage detected