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

Class Upsample

ldm/modules/diffusionmodules/model.py:57–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56
57class Upsample(nn.Module):
58 def __init__(self, in_channels, with_conv):
59 super().__init__()
60 self.with_conv = with_conv
61 if self.with_conv:
62 self.conv = torch.nn.Conv2d(in_channels,
63 in_channels,
64 kernel_size=3,
65 stride=1,
66 padding=1)
67
68 def forward(self, x):
69 x = torch.nn.functional.interpolate(x, scale_factor=2.0, mode="nearest")
70 if self.with_conv:
71 x = self.conv(x)
72 return x
73
74
75class Downsample(nn.Module):

Callers 4

__init__Method · 0.70
__init__Method · 0.70
__init__Method · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected