(self, z)
| 93 | return latents.detach().cpu() |
| 94 | |
| 95 | def decode_to_images(self, z): |
| 96 | with torch.no_grad(): |
| 97 | if not z.is_cuda: |
| 98 | z = z.cuda() |
| 99 | |
| 100 | B, C, H_latent, W_latent = z.shape |
| 101 | self._current_img_h = H_latent * self.patch_size |
| 102 | self._current_img_w = W_latent * self.patch_size |
| 103 | |
| 104 | decoded = self.model.get_latents_decoded_images(z) |
| 105 | |
| 106 | # Apply inverse normalization to get [0, 1] range |
| 107 | decoded = self.transform_inv(decoded) |
| 108 | # Convert to [0, 255] uint8 |
| 109 | images = torch.clamp(decoded * 255, 0, 255) |
| 110 | images = images.permute(0, 2, 3, 1).to("cpu", dtype=torch.uint8).numpy() |
| 111 | return images |
nothing calls this directly
no test coverage detected