MCPcopy Create free account
hub / github.com/NVlabs/CTG / src2pos

Method src2pos

tbsim/models/Transformer.py:43–50  ·  view source on GitHub ↗

extract positional info from src for all datatypes, e.g., for vehicles, the first two dimensions are x and y

(self, src, dyn_type)

Source from the content-addressed store, hash-verified

41 self.src2posfun = src2posfun
42
43 def src2pos(self, src, dyn_type):
44 "extract positional info from src for all datatypes, e.g., for vehicles, the first two dimensions are x and y"
45
46 pos = torch.zeros([*src.shape[:-1], 2]).to(src.device)
47 for dt, fun in self.src2posfun.items():
48 pos += fun(src) * (dyn_type == dt).view([*(dyn_type.shape), 1, 1])
49
50 return pos
51
52 def forward(
53 self,

Callers 1

forwardMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected