Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions generative/networks/nets/vqvae.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,12 @@ def forward(self, images: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:

return reconstruction, quantization_losses

def encode_stage_2_inputs(self, x: torch.Tensor) -> torch.Tensor:
def encode_stage_2_inputs(self, x: torch.Tensor, quantized: bool = True) -> torch.Tensor:
z = self.encode(x)
e, _ = self.quantize(z)
return e
if quantized:
return e
return z

def decode_stage_2_outputs(self, z: torch.Tensor) -> torch.Tensor:
e, _ = self.quantize(z)
Expand Down