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

Method full

pixal3d/modules/sparse/basic.py:692–703  ·  view source on GitHub ↗
(aabb, dim, value, dtype=torch.float32, device=None)

Source from the content-addressed store, hash-verified

690
691 @staticmethod
692 def full(aabb, dim, value, dtype=torch.float32, device=None) -> 'SparseTensor':
693 N, C = dim
694 x = torch.arange(aabb[0], aabb[3] + 1)
695 y = torch.arange(aabb[1], aabb[4] + 1)
696 z = torch.arange(aabb[2], aabb[5] + 1)
697 coords = torch.stack(torch.meshgrid(x, y, z, indexing='ij'), dim=-1).reshape(-1, 3)
698 coords = torch.cat([
699 torch.arange(N).view(-1, 1).repeat(1, coords.shape[0]).view(-1, 1),
700 coords.repeat(N, 1),
701 ], dim=1).to(dtype=torch.int32, device=device)
702 feats = torch.full((coords.shape[0], C), value, dtype=dtype, device=device)
703 return SparseTensor(feats=feats, coords=coords)
704
705 def __merge_sparse_cache(self, other: 'SparseTensor') -> dict:
706 new_cache = {}

Callers 8

text_imageFunction · 0.80
text_imageFunction · 0.80
renderMethod · 0.80
renderMethod · 0.80
visualize_sampleMethod · 0.80
collate_fnMethod · 0.80
collate_fnMethod · 0.80
collate_fnMethod · 0.80

Calls 3

SparseTensorClass · 0.85
reshapeMethod · 0.45
toMethod · 0.45

Tested by

no test coverage detected