(self, x, no_dropout=False)
| 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"): |
nothing calls this directly
no test coverage detected