MCPcopy Create free account
hub / github.com/Gadersd/stable-diffusion-burn / ResnetBlock

Class ResnetBlock

python/dump.py:54–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52 return x + self.proj_out(h_)
53
54class ResnetBlock:
55 def __init__(self, in_channels, out_channels=None):
56 self.norm1 = GroupNorm(32, in_channels)
57 self.conv1 = Conv2d(in_channels, out_channels, 3, padding=1)
58 self.norm2 = GroupNorm(32, out_channels)
59 self.conv2 = Conv2d(out_channels, out_channels, 3, padding=1)
60 self.nin_shortcut = Conv2d(in_channels, out_channels, 1) if in_channels != out_channels else lambda x: x
61
62 def __call__(self, x):
63 h = self.conv1(self.norm1(x).swish())
64 h = self.conv2(self.norm2(h).swish())
65 return self.nin_shortcut(x) + h
66
67class Mid:
68 def __init__(self, block_in):

Callers 3

__init__Method · 0.70
__init__Method · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected