Wrapper nn.Module wrapper for pipe.encode() method
| 598 | } |
| 599 | |
| 600 | class VAEEncoder(nn.Module): |
| 601 | """ Wrapper nn.Module wrapper for pipe.encode() method |
| 602 | """ |
| 603 | |
| 604 | def __init__(self): |
| 605 | super().__init__() |
| 606 | self.quant_conv = pipe.vae.quant_conv.to(dtype=torch.float32) |
| 607 | self.encoder = pipe.vae.encoder.to(dtype=torch.float32) |
| 608 | |
| 609 | def forward(self, x): |
| 610 | return self.quant_conv(self.encoder(x)) |
| 611 | |
| 612 | baseline_encoder = VAEEncoder().eval() |
| 613 |
no outgoing calls
no test coverage detected