MCPcopy Create free account
hub / github.com/tdrussell/diffusion-pipe / sample_t

Function sample_t

utils/common.py:155–160  ·  view source on GitHub ↗
(t, batch_size, quantile=None)

Source from the content-addressed store, hash-verified

153
154
155def sample_t(t, batch_size, quantile=None):
156 if quantile is not None:
157 i = (torch.full((batch_size,), quantile) * len(t)).to(torch.int32)
158 else:
159 i = torch.randint(0, len(t), size=(batch_size,))
160 return t[i]

Callers 1

prepare_inputsMethod · 0.90

Calls 1

toMethod · 0.45

Tested by

no test coverage detected