MCPcopy Create free account
hub / github.com/Yasoz/DiffTraj / gather

Function gather

utils/utils.py:39–47  ·  view source on GitHub ↗

Gather consts for $t$ and reshape to feature map shape :param consts: (N, 1, 1) :param t: (N, H, W) :return: (N, H, W)

(consts: torch.Tensor, t: torch.Tensor)

Source from the content-addressed store, hash-verified

37
38
39def gather(consts: torch.Tensor, t: torch.Tensor):
40 """
41 Gather consts for $t$ and reshape to feature map shape
42 :param consts: (N, 1, 1)
43 :param t: (N, H, W)
44 :return: (N, H, W)
45 """
46 c = consts.gather(-1, t)
47 return c.reshape(-1, 1, 1)
48
49
50def q_xt_x0(x0, t, alpha_bar):

Callers 1

q_xt_x0Function · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected