MCPcopy Index your code
hub / github.com/microsoft/TRELLIS / full

Method full

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

Source from the content-addressed store, hash-verified

275
276 @staticmethod
277 def full(aabb, dim, value, dtype=torch.float32, device=None) -> 'SparseTensor':
278 N, C = dim
279 x = torch.arange(aabb[0], aabb[3] + 1)
280 y = torch.arange(aabb[1], aabb[4] + 1)
281 z = torch.arange(aabb[2], aabb[5] + 1)
282 coords = torch.stack(torch.meshgrid(x, y, z, indexing='ij'), dim=-1).reshape(-1, 3)
283 coords = torch.cat([
284 torch.arange(N).view(-1, 1).repeat(1, coords.shape[0]).view(-1, 1),
285 coords.repeat(N, 1),
286 ], dim=1).to(dtype=torch.int32, device=device)
287 feats = torch.full((coords.shape[0], C), value, dtype=dtype, device=device)
288 return SparseTensor(feats=feats, coords=coords)
289
290 def __merge_sparse_cache(self, other: 'SparseTensor') -> dict:
291 new_cache = {}

Callers 9

postprocess_meshFunction · 0.80
visualize_sampleMethod · 0.80
collate_fnMethod · 0.80
collate_fnMethod · 0.80
collate_fnMethod · 0.80
visualize_sampleMethod · 0.80
to_representationMethod · 0.80
get_densityMethod · 0.80
structure_controlMethod · 0.80

Calls 3

SparseTensorClass · 0.85
reshapeMethod · 0.80
toMethod · 0.45

Tested by

no test coverage detected