MCPcopy Create free account
hub / github.com/Francis-Rings/FlashPortrait / init_weight2

Method init_weight2

wan/models/wan_vae.py:178–187  ·  view source on GitHub ↗
(self, conv)

Source from the content-addressed store, hash-verified

176 nn.init.zeros_(conv.bias.data)
177
178 def init_weight2(self, conv):
179 conv_weight = conv.weight.data
180 nn.init.zeros_(conv_weight)
181 c1, c2, t, h, w = conv_weight.size()
182 init_matrix = torch.eye(c1 // 2, c2)
183 #init_matrix = repeat(init_matrix, 'o ... -> (o 2) ...').permute(1,0,2).contiguous().reshape(c1,c2)
184 conv_weight[:c1 // 2, :, -1, 0, 0] = init_matrix
185 conv_weight[c1 // 2:, :, -1, 0, 0] = init_matrix
186 conv.weight.data.copy_(conv_weight)
187 nn.init.zeros_(conv.bias.data)
188
189
190class ResidualBlock(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected