MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / WanRMSNorm

Class WanRMSNorm

models/transformer/wan/modules/t2m_model.py:234–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232
233
234class WanRMSNorm(nn.Module):
235
236 def __init__(self, dim, eps=1e-5):
237 super().__init__()
238 self.dim = dim
239 self.eps = eps
240 self.weight = nn.Parameter(torch.ones(dim))
241
242 def forward(self, x):
243 return self._norm(x.float()).type_as(x) * self.weight
244
245 def _norm(self, x):
246 return x * torch.rsqrt(x.pow(2).mean(dim=-1, keepdim=True) + self.eps)
247
248
249class WanLayerNorm(nn.LayerNorm):

Callers 2

__init__Method · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected