MCPcopy Create free account
hub / github.com/CompVis/diff2flow / forward

Method forward

diff2flow/conditioning/encoders.py:50–56  ·  view source on GitHub ↗
(self, x, no_dropout=False)

Source from the content-addressed store, hash-verified

48 return x
49
50 def forward(self, x, no_dropout=False):
51 # x is assumed to be in range [-1,1]
52 out = self.model.encode_image(self.preprocess(x))
53 out = out.to(x.dtype)
54 if self.ucg_rate > 0. and not no_dropout:
55 out = torch.bernoulli((1. - self.ucg_rate) * torch.ones(out.shape[0], device=out.device))[:, None] * out
56 return out.unsqueeze(1)
57
58 @torch.no_grad()
59 def get_unconditional_conditioning(self, device="cuda"):

Callers

nothing calls this directly

Calls 1

preprocessMethod · 0.95

Tested by

no test coverage detected