MCPcopy Create free account
hub / github.com/ali-vilab/ACE_plus / __init__

Method __init__

modules/layers.py:496–500  ·  view source on GitHub ↗
(self, hidden_size: int, patch_size: int, out_channels: int)

Source from the content-addressed store, hash-verified

494
495class LastLayer(nn.Module):
496 def __init__(self, hidden_size: int, patch_size: int, out_channels: int):
497 super().__init__()
498 self.norm_final = nn.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6)
499 self.linear = nn.Linear(hidden_size, patch_size * patch_size * out_channels, bias=True)
500 self.adaLN_modulation = nn.Sequential(nn.SiLU(), nn.Linear(hidden_size, 2 * hidden_size, bias=True))
501
502 def forward(self, x: Tensor, vec: Tensor) -> Tensor:
503 shift, scale = self.adaLN_modulation(vec).chunk(2, dim=1)

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected