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

Class WanRMSNorm

wan/modules/model.py:73–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

__init__Method · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected