MCPcopy Create free account
hub / github.com/dek924/PerX2CT / __init__

Method __init__

taming/modules/diffusionmodules/model.py:79–115  ·  view source on GitHub ↗
(self, *, in_channels, out_channels=None, conv_shortcut=False,
                 dropout, temb_channels=512)

Source from the content-addressed store, hash-verified

77
78class ResnetBlock(nn.Module):
79 def __init__(self, *, in_channels, out_channels=None, conv_shortcut=False,
80 dropout, temb_channels=512):
81 super().__init__()
82 self.in_channels = in_channels
83 out_channels = in_channels if out_channels is None else out_channels
84 self.out_channels = out_channels
85 self.use_conv_shortcut = conv_shortcut
86
87 self.norm1 = Normalize(in_channels)
88 self.conv1 = torch.nn.Conv2d(in_channels,
89 out_channels,
90 kernel_size=3,
91 stride=1,
92 padding=1)
93 if temb_channels > 0:
94 self.temb_proj = torch.nn.Linear(temb_channels,
95 out_channels)
96 self.norm2 = Normalize(out_channels)
97 self.dropout = torch.nn.Dropout(dropout)
98 self.conv2 = torch.nn.Conv2d(out_channels,
99 out_channels,
100 kernel_size=3,
101 stride=1,
102 padding=1)
103 if self.in_channels != self.out_channels:
104 if self.use_conv_shortcut:
105 self.conv_shortcut = torch.nn.Conv2d(in_channels,
106 out_channels,
107 kernel_size=3,
108 stride=1,
109 padding=1)
110 else:
111 self.nin_shortcut = torch.nn.Conv2d(in_channels,
112 out_channels,
113 kernel_size=1,
114 stride=1,
115 padding=0)
116
117 def forward(self, x, temb):
118 h = x

Callers

nothing calls this directly

Calls 2

NormalizeFunction · 0.70
__init__Method · 0.45

Tested by

no test coverage detected