MCPcopy Create free account
hub / github.com/IceClear/StableSR / Upsample

Class Upsample

ldm/modules/diffusionmodules/model.py:80–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78
79
80class Upsample(nn.Module):
81 def __init__(self, in_channels, with_conv):
82 super().__init__()
83 self.with_conv = with_conv
84 if self.with_conv:
85 self.conv = torch.nn.Conv2d(in_channels,
86 in_channels,
87 kernel_size=3,
88 stride=1,
89 padding=1)
90
91 def forward(self, x):
92 x = torch.nn.functional.interpolate(x, scale_factor=2.0, mode="nearest")
93 if self.with_conv:
94 x = self.conv(x)
95 return x
96
97
98class Downsample(nn.Module):

Callers 5

__init__Method · 0.70
__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