MCPcopy Index your code
hub / github.com/apple/ml-stable-diffusion / VAEEncoder

Class VAEEncoder

python_coreml_stable_diffusion/torch2coreml.py:600–610  ·  view source on GitHub ↗

Wrapper nn.Module wrapper for pipe.encode() method

Source from the content-addressed store, hash-verified

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

Callers 1

convert_vae_encoderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected