(
self, h: torch.FloatTensor, force_not_quantize: bool = False, return_dict: bool = True
)
| 126 | return VQEncoderOutput(latents=h) |
| 127 | |
| 128 | def decode( |
| 129 | self, h: torch.FloatTensor, force_not_quantize: bool = False, return_dict: bool = True |
| 130 | ) -> Union[DecoderOutput, torch.FloatTensor]: |
| 131 | # also go through quantization layer |
| 132 | if not force_not_quantize: |
| 133 | quant, emb_loss, info = self.quantize(h) |
| 134 | else: |
| 135 | quant = h |
| 136 | quant2 = self.post_quant_conv(quant) |
| 137 | dec = self.decoder(quant2, quant if self.config.norm_type == "spatial" else None) |
| 138 | |
| 139 | if not return_dict: |
| 140 | return (dec,) |
| 141 | |
| 142 | return DecoderOutput(sample=dec) |
| 143 | |
| 144 | def forward(self, sample: torch.FloatTensor, return_dict: bool = True) -> Union[DecoderOutput, torch.FloatTensor]: |
| 145 | r""" |
no test coverage detected