(self, imgs, deterministic=False)
| 573 | return eps * std + mu |
| 574 | |
| 575 | def sample(self, imgs, deterministic=False): |
| 576 | mu, log_var = self.encode(imgs) |
| 577 | if deterministic: |
| 578 | return mu |
| 579 | std = torch.exp(0.5 * log_var.clamp(-30.0, 20.0)) |
| 580 | return mu + std * torch.randn_like(std) |
| 581 | |
| 582 | def clear_cache(self): |
| 583 | self._conv_num = count_conv3d(self.decoder) |