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

Method forward

diff2flow/conditioning/encoders.py:133–137  ·  view source on GitHub ↗
(self, image, no_dropout=False)

Source from the content-addressed store, hash-verified

131 param.requires_grad = False
132
133 def forward(self, image, no_dropout=False):
134 z = self.encode_with_vision_transformer(image)
135 if self.ucg_rate > 0. and not no_dropout:
136 z = torch.bernoulli((1. - self.ucg_rate) * torch.ones(z.shape[0], device=z.device))[:, None] * z
137 return z.unsqueeze(1)
138
139 def encode_with_vision_transformer(self, img):
140 img = self.preprocess(img)

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected