MCPcopy Create free account
hub / github.com/MeiGen-AI/MultiTalk / WanRMSNorm

Class WanRMSNorm

wan/modules/multitalk_model.py:79–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77
78
79class WanRMSNorm(nn.Module):
80
81 def __init__(self, dim, eps=1e-5):
82 super().__init__()
83 self.dim = dim
84 self.eps = eps
85 self.weight = nn.Parameter(torch.ones(dim))
86
87 def forward(self, x):
88 r"""
89 Args:
90 x(Tensor): Shape [B, L, C]
91 """
92 return self._norm(x.float()).type_as(x) * self.weight
93
94 def _norm(self, x):
95 return x * torch.rsqrt(x.pow(2).mean(dim=-1, keepdim=True) + self.eps)
96
97
98class WanLayerNorm(nn.LayerNorm):

Callers 2

__init__Method · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected