MCPcopy
hub / github.com/TencentARC/Pixal3D / __cal_layout

Method __cal_layout

pixal3d/modules/sparse/basic.py:467–471  ·  view source on GitHub ↗
(self, coords, batch_size)

Source from the content-addressed store, hash-verified

465 return torch.Size(shape)
466
467 def __cal_layout(self, coords, batch_size):
468 seq_len = torch.bincount(coords[:, 0], minlength=batch_size)
469 offset = torch.cumsum(seq_len, dim=0)
470 layout = [slice((offset[i] - seq_len[i]).item(), offset[i].item()) for i in range(batch_size)]
471 return layout
472
473 def __cal_spatial_shape(self, coords):
474 return torch.Size((coords[:, 1:].max(0)[0] + 1).tolist())

Callers 2

__init__Method · 0.95
layoutMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected