MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / forward

Method forward

src/diffusers/models/normalization.py:251–254  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

249 self.beta = nn.Parameter(torch.zeros(1, 1, 1, dim))
250
251 def forward(self, x):
252 gx = torch.norm(x, p=2, dim=(1, 2), keepdim=True)
253 nx = gx / (gx.mean(dim=-1, keepdim=True) + 1e-6)
254 return self.gamma * (x * nx) + self.beta + x

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected