MCPcopy Create free account
hub / github.com/GasaiYU/PartRM / __init__

Method __init__

core/unet.py:187–216  ·  view source on GitHub ↗
(
        self,
        in_channels: int,
        prev_out_channels: int,
        out_channels: int,
        num_layers: int = 1,
        upsample: bool = True,
        attention: bool = True,
        attention_heads: int = 16,
        skip_scale: float = 1,
    )

Source from the content-addressed store, hash-verified

185
186class UpBlock(nn.Module):
187 def __init__(
188 self,
189 in_channels: int,
190 prev_out_channels: int,
191 out_channels: int,
192 num_layers: int = 1,
193 upsample: bool = True,
194 attention: bool = True,
195 attention_heads: int = 16,
196 skip_scale: float = 1,
197 ):
198 super().__init__()
199
200 nets = []
201 attns = []
202 for i in range(num_layers):
203 cin = in_channels if i == 0 else out_channels
204 cskip = prev_out_channels if (i == num_layers - 1) else out_channels
205
206 nets.append(ResnetBlock(cin + cskip, out_channels, skip_scale=skip_scale))
207 if attention:
208 attns.append(MVAttention(out_channels, attention_heads, skip_scale=skip_scale))
209 else:
210 attns.append(None)
211 self.nets = nn.ModuleList(nets)
212 self.attns = nn.ModuleList(attns)
213
214 self.upsample = None
215 if upsample:
216 self.upsample = nn.Conv2d(out_channels, out_channels, kernel_size=3, stride=1, padding=1)
217
218 def forward(self, x, xs):
219

Callers

nothing calls this directly

Calls 3

ResnetBlockClass · 0.85
MVAttentionClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected