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

Method __init__

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

Source from the content-addressed store, hash-verified

151
152class MidBlock(nn.Module):
153 def __init__(
154 self,
155 in_channels: int,
156 num_layers: int = 1,
157 attention: bool = True,
158 attention_heads: int = 16,
159 skip_scale: float = 1,
160 ):
161 super().__init__()
162
163 nets = []
164 attns = []
165 # first layer
166 nets.append(ResnetBlock(in_channels, in_channels, skip_scale=skip_scale))
167 # more layers
168 for i in range(num_layers):
169 nets.append(ResnetBlock(in_channels, in_channels, skip_scale=skip_scale))
170 if attention:
171 attns.append(MVAttention(in_channels, attention_heads, skip_scale=skip_scale))
172 else:
173 attns.append(None)
174 self.nets = nn.ModuleList(nets)
175 self.attns = nn.ModuleList(attns)
176
177 def forward(self, x):
178 x = self.nets[0](x)

Callers

nothing calls this directly

Calls 3

ResnetBlockClass · 0.85
MVAttentionClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected