MCPcopy Create free account
hub / github.com/MAC-VO/MAC-VO / init

Method init

Module/Map/Graph.py:33–38  ·  view source on GitHub ↗
(cls: type[Self], data: dict[T_Fields, torch.Tensor])

Source from the content-addressed store, hash-verified

31
32 @classmethod
33 def init(cls: type[Self], data: dict[T_Fields, torch.Tensor]) -> Self:
34 sizes = [v.size(0) for v in data.values()]
35 assert all([s == sizes[0] for s in sizes]), f"TensorBundle requires all features have (Nx...) shape with same 'N', get {sizes}"
36
37 index = torch.arange(0, sizes[0], dtype=torch.long)
38 return cls(index, data)
39
40 def __getitem__(self, index) -> TensorBundle[T_Fields]:
41 selected_dict: dict[T_Fields, torch.Tensor] = {

Callers 10

trainFunction · 0.80
deserializeMethod · 0.80
init_connectMethod · 0.80
init_saveMethod · 0.80
runMethod · 0.80
terminateMethod · 0.80
initializeMethod · 0.80
run_pairMethod · 0.80
push_keyframeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected