MCPcopy
hub / github.com/ermongroup/ddim / Upsample

Class Upsample

models/diffusion.py:36–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34
35
36class Upsample(nn.Module):
37 def __init__(self, in_channels, with_conv):
38 super().__init__()
39 self.with_conv = with_conv
40 if self.with_conv:
41 self.conv = torch.nn.Conv2d(in_channels,
42 in_channels,
43 kernel_size=3,
44 stride=1,
45 padding=1)
46
47 def forward(self, x):
48 x = torch.nn.functional.interpolate(
49 x, scale_factor=2.0, mode="nearest")
50 if self.with_conv:
51 x = self.conv(x)
52 return x
53
54
55class Downsample(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected