MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / to_rgb

Method to_rgb

ldm/models/diffusion/ddpm.py:1311–1317  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

1309
1310 @torch.no_grad()
1311 def to_rgb(self, x):
1312 x = x.float()
1313 if not hasattr(self, "colorize"):
1314 self.colorize = torch.randn(3, x.shape[1], 1, 1).to(x)
1315 x = nn.functional.conv2d(x, weight=self.colorize)
1316 x = 2. * (x - x.min()) / (x.max() - x.min()) - 1.
1317 return x
1318
1319
1320class DiffusionWrapper(pl.LightningModule):

Callers 3

log_imagesMethod · 0.95
log_imagesMethod · 0.45
log_imagesMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected