MCPcopy Create free account
hub / github.com/DSL-Lab/StreamSplat / matrix

Function matrix

datasets/augmentv2.py:74–82  ·  view source on GitHub ↗
(*rows, device=None)

Source from the content-addressed store, hash-verified

72# Helpers for constructing transformation matrices (unchanged).
73
74def matrix(*rows, device=None):
75 assert all(len(row) == len(rows[0]) for row in rows)
76 elems = [x for row in rows for x in row]
77 ref = [x for x in elems if isinstance(x, torch.Tensor)]
78 if len(ref) == 0:
79 return constant(np.asarray(rows), device=device)
80 assert device is None or device == ref[0].device
81 elems = [x if isinstance(x, torch.Tensor) else constant(x, shape=ref[0].shape, device=ref[0].device) for x in elems]
82 return torch.stack(elems, dim=-1).reshape(ref[0].shape + (len(rows), -1))
83
84def translate2d(tx, ty, **kwargs):
85 return matrix(

Callers 7

translate2dFunction · 0.85
translate3dFunction · 0.85
scale2dFunction · 0.85
scale3dFunction · 0.85
rotate2dFunction · 0.85
rotate3dFunction · 0.85
__call__Method · 0.85

Calls 1

constantFunction · 0.85

Tested by

no test coverage detected